cog/Plugins/CueSheet/CueSheetMetadataReader.m

61 lines
1.1 KiB
Matlab
Raw Normal View History

2007-10-13 01:36:42 +00:00
//
// CueSheetMetadataReader.m
// CueSheet
//
// Created by Vincent Spader on 10/12/07.
// Copyright 2007 __MyCompanyName__. All rights reserved.
//
#import "CueSheetMetadataReader.h"
#import "CueSheetDecoder.h"
#import "CueSheet.h"
#import "CueSheetTrack.h"
@implementation CueSheetMetadataReader
+ (NSArray *)fileTypes
{
return [CueSheetDecoder fileTypes];
}
2007-10-14 18:56:23 +00:00
+ (NSArray *)mimeTypes
{
return [CueSheetDecoder mimeTypes];
}
+ (float)priority
{
return 1.0f;
}
2007-10-13 01:36:42 +00:00
+ (NSDictionary *)metadataForURL:(NSURL *)url
{
if (![url isFileURL]) {
return nil;
}
CueSheet *cuesheet = [CueSheet cueSheetWithFile:[url path]];
NSArray *tracks = [cuesheet tracks];
for (CueSheetTrack *track in tracks)
2007-10-13 01:36:42 +00:00
{
if ([[url fragment] isEqualToString:[track track]])
{
return [NSDictionary dictionaryWithObjectsAndKeys:
[track artist], @"artist",
[track album], @"album",
[track title], @"title",
[NSNumber numberWithInt:[[track track] intValue]], @"track",
2007-10-13 01:36:42 +00:00
[track genre], @"genre",
2013-10-11 13:20:08 +00:00
[NSNumber numberWithInt:[[track year] intValue]], @"year",
2007-10-13 01:36:42 +00:00
nil];
}
}
return nil;
}
@end