From 33f3b4f5a0a4453c566d1adafb27c40c719a07ef Mon Sep 17 00:00:00 2001 From: Christopher Snowhill Date: Fri, 14 Jan 2022 19:05:48 -0800 Subject: [PATCH] CueSheet processor: Support timestamps with one or two fields, as well as the standard three fields --- Plugins/CueSheet/CueSheet.m | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/Plugins/CueSheet/CueSheet.m b/Plugins/CueSheet/CueSheet.m index 217a90e66..1e325f1fe 100644 --- a/Plugins/CueSheet/CueSheet.m +++ b/Plugins/CueSheet/CueSheet.m @@ -176,11 +176,19 @@ } NSArray *msf = [time componentsSeparatedByString:@":"]; - if ([msf count] != 3) { + size_t count = [msf count]; + if (count < 1 || count > 3) { continue; } - - double seconds = (60*[[msf objectAtIndex:0] intValue]) + [[msf objectAtIndex:1] intValue] + ([[msf objectAtIndex:2] floatValue]/75); + + double seconds = 0; + + if (count == 1) + seconds = [[msf objectAtIndex:0] floatValue] / 75; + else if (count == 2) + seconds = [[msf objectAtIndex:0] intValue] + ([[msf objectAtIndex:1] floatValue]/75); + else if (count == 3) + seconds = (60*[[msf objectAtIndex:0] intValue]) + [[msf objectAtIndex:1] intValue] + ([[msf objectAtIndex:2] floatValue]/75); if (track == nil) { track = @"01";