diff --git a/Plugins/CueSheet/CueSheetContainer.m b/Plugins/CueSheet/CueSheetContainer.m index 234383576..87a80712d 100644 --- a/Plugins/CueSheet/CueSheetContainer.m +++ b/Plugins/CueSheet/CueSheetContainer.m @@ -50,11 +50,34 @@ NSDictionary *alsoMetadata = [NSClassFromString(@"AudioPropertiesReader") propertiesForURL:url skipCue:YES]; - NSString *sheet = [fileMetadata objectForKey:@"cuesheet"]; - if(!sheet || ![sheet length]) sheet = [alsoMetadata objectForKey:@"cuesheet"]; + id sheet = [fileMetadata objectForKey:@"cuesheet"]; + NSString *sheetString = nil; + if(sheet) { + if([sheet isKindOfClass:[NSArray class]]) { + NSArray *sheetContainer = sheet; + if([sheetContainer count]) { + sheetString = sheetContainer[0]; + } + } else if([sheet isKindOfClass:[NSString class]]) { + sheetString = sheet; + } + } + if(!sheetString || ![sheetString length]) { + sheet = [alsoMetadata objectForKey:@"cuesheet"]; + if(sheet) { + if([sheet isKindOfClass:[NSArray class]]) { + NSArray *sheetContainer = sheet; + if([sheetContainer count]) { + sheetString = sheetContainer[0]; + } + } else if([sheet isKindOfClass:[NSString class]]) { + sheetString = sheet; + } + } + } - if([sheet length]) { - cuesheet = [CueSheet cueSheetWithString:sheet withFilename:[url path]]; + if(sheetString && [sheetString length]) { + cuesheet = [CueSheet cueSheetWithString:sheetString withFilename:[url path]]; } embedded = YES; } else diff --git a/Plugins/CueSheet/CueSheetDecoder.m b/Plugins/CueSheet/CueSheetDecoder.m index c32fdba41..6aab78079 100644 --- a/Plugins/CueSheet/CueSheetDecoder.m +++ b/Plugins/CueSheet/CueSheetDecoder.m @@ -92,11 +92,34 @@ static void *kCueSheetDecoderContext = &kCueSheetDecoderContext; NSDictionary *alsoMetadata = [decoder metadata]; - NSString *sheet = [fileMetadata objectForKey:@"cuesheet"]; - if(!sheet || ![sheet length]) sheet = [alsoMetadata objectForKey:@"cuesheet"]; + id sheet = [fileMetadata objectForKey:@"cuesheet"]; + NSString *sheetString = nil; + if(sheet) { + if([sheet isKindOfClass:[NSArray class]]) { + NSArray *sheetContainer = sheet; + if([sheetContainer count]) { + sheetString = sheetContainer[0]; + } + } else if([sheet isKindOfClass:[NSString class]]) { + sheetString = sheet; + } + } + if(!sheetString || ![sheetString length]) { + sheet = [alsoMetadata objectForKey:@"cuesheet"]; + if(sheet) { + if([sheet isKindOfClass:[NSArray class]]) { + NSArray *sheetContainer = sheet; + if([sheetContainer count]) { + sheetString = sheetContainer[0]; + } + } else if([sheet isKindOfClass:[NSString class]]) { + sheetString = sheet; + } + } + } - if([sheet length]) { - cuesheet = [CueSheet cueSheetWithString:sheet withFilename:[url path]]; + if(sheetString && [sheetString length]) { + cuesheet = [CueSheet cueSheetWithString:sheetString withFilename:[url path]]; embedded = YES; } diff --git a/Plugins/CueSheet/CueSheetMetadataReader.m b/Plugins/CueSheet/CueSheetMetadataReader.m index 3f7f0bde6..c42fae680 100644 --- a/Plugins/CueSheet/CueSheetMetadataReader.m +++ b/Plugins/CueSheet/CueSheetMetadataReader.m @@ -46,11 +46,34 @@ NSDictionary *alsoMetadata = [NSClassFromString(@"AudioPropertiesReader") propertiesForURL:url skipCue:YES]; - NSString *sheet = [fileMetadata objectForKey:@"cuesheet"]; - if(!sheet || ![sheet length]) sheet = [alsoMetadata objectForKey:@"cuesheet"]; + id sheet = [fileMetadata objectForKey:@"cuesheet"]; + NSString *sheetString = nil; + if(sheet) { + if([sheet isKindOfClass:[NSArray class]]) { + NSArray *sheetContainer = sheet; + if([sheetContainer count]) { + sheetString = sheetContainer[0]; + } + } else if([sheet isKindOfClass:[NSString class]]) { + sheetString = sheet; + } + } + if(!sheetString || ![sheetString length]) { + sheet = [alsoMetadata objectForKey:@"cuesheet"]; + if(sheet) { + if([sheet isKindOfClass:[NSArray class]]) { + NSArray *sheetContainer = sheet; + if([sheetContainer count]) { + sheetString = sheetContainer[0]; + } + } else if([sheet isKindOfClass:[NSString class]]) { + sheetString = sheet; + } + } + } - if([sheet length]) { - cuesheet = [CueSheet cueSheetWithString:sheet withFilename:[url path]]; + if(sheetString && [sheetString length]) { + cuesheet = [CueSheet cueSheetWithString:sheetString withFilename:[url path]]; embedded = YES; } } else