Added metadata reading to cue sheets.
parent
97e662208d
commit
b51d8aedb5
|
@ -56,7 +56,6 @@
|
||||||
return NO;
|
return NO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
[converterNode setOutputFormat:outputFormat];
|
[converterNode setOutputFormat:outputFormat];
|
||||||
|
|
||||||
if (![inputNode openURL:url withSource:source])
|
if (![inputNode openURL:url withSource:source])
|
||||||
|
|
|
@ -51,6 +51,12 @@
|
||||||
|
|
||||||
NSString *track = nil;
|
NSString *track = nil;
|
||||||
NSString *path = nil;
|
NSString *path = nil;
|
||||||
|
NSString *artist = nil;
|
||||||
|
NSString *album = nil;
|
||||||
|
NSString *title = nil;
|
||||||
|
NSString *genre = nil;
|
||||||
|
NSString *year = nil;
|
||||||
|
|
||||||
BOOL trackAdded = NO;
|
BOOL trackAdded = NO;
|
||||||
|
|
||||||
NSCharacterSet *whitespace = [NSCharacterSet whitespaceAndNewlineCharacterSet];
|
NSCharacterSet *whitespace = [NSCharacterSet whitespaceAndNewlineCharacterSet];
|
||||||
|
@ -73,7 +79,7 @@
|
||||||
track = nil;
|
track = nil;
|
||||||
trackAdded = NO;
|
trackAdded = NO;
|
||||||
|
|
||||||
if (![scanner scanString:@"\"" intoString:&command]) {
|
if (![scanner scanString:@"\"" intoString:nil]) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -112,8 +118,6 @@
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
NSLog(@"Index: %@", index);
|
|
||||||
|
|
||||||
[scanner scanCharactersFromSet:whitespace intoString:nil];
|
[scanner scanCharactersFromSet:whitespace intoString:nil];
|
||||||
|
|
||||||
NSString *time = nil;
|
NSString *time = nil;
|
||||||
|
@ -136,9 +140,67 @@
|
||||||
[entries addObject:
|
[entries addObject:
|
||||||
[CueSheetTrack trackWithURL:[self urlForPath:path relativeTo:filename]
|
[CueSheetTrack trackWithURL:[self urlForPath:path relativeTo:filename]
|
||||||
track: track
|
track: track
|
||||||
time: seconds]];
|
time: seconds
|
||||||
|
artist:artist
|
||||||
|
album:album
|
||||||
|
title:title
|
||||||
|
genre:genre
|
||||||
|
year:year]];
|
||||||
trackAdded = YES;
|
trackAdded = YES;
|
||||||
}
|
}
|
||||||
|
else if ([command isEqualToString:@"PERFORMER"])
|
||||||
|
{
|
||||||
|
if (![scanner scanString:@"\"" intoString:nil]) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Read in the path
|
||||||
|
if (![scanner scanUpToString:@"\"" intoString:&artist]) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if ([command isEqualToString:@"TITLE"])
|
||||||
|
{
|
||||||
|
NSString **titleDest;
|
||||||
|
if (!path) //Have not come across a file yet.
|
||||||
|
titleDest = &album;
|
||||||
|
else
|
||||||
|
titleDest = &title;
|
||||||
|
|
||||||
|
if (![scanner scanString:@"\"" intoString:nil]) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Read in the path
|
||||||
|
if (![scanner scanUpToString:@"\"" intoString:titleDest]) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if ([command isEqualToString:@"REM"]) //Additional metadata sometimes stored in comments
|
||||||
|
{
|
||||||
|
NSString *type;
|
||||||
|
NSString **dest = NULL;
|
||||||
|
|
||||||
|
if (![scanner scanUpToCharactersFromSet:whitespace intoString:&type]) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if ([type isEqualToString:@"GENRE"])
|
||||||
|
{
|
||||||
|
dest = &genre;
|
||||||
|
}
|
||||||
|
else if ([type isEqualToString:@"DATE"])
|
||||||
|
{
|
||||||
|
dest = &year;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( ![scanner scanUpToCharactersFromSet:whitespace intoString:dest]) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[scanner release];
|
[scanner release];
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
objects = {
|
objects = {
|
||||||
|
|
||||||
/* Begin PBXBuildFile section */
|
/* Begin PBXBuildFile section */
|
||||||
|
17DA346E0CC04FCD0003F6B2 /* CueSheetMetadataReader.m in Sources */ = {isa = PBXBuildFile; fileRef = 17DA346D0CC04FCD0003F6B2 /* CueSheetMetadataReader.m */; };
|
||||||
17F3BB680CBC560700864489 /* CueSheetPropertiesReader.m in Sources */ = {isa = PBXBuildFile; fileRef = 17F3BB670CBC560700864489 /* CueSheetPropertiesReader.m */; };
|
17F3BB680CBC560700864489 /* CueSheetPropertiesReader.m in Sources */ = {isa = PBXBuildFile; fileRef = 17F3BB670CBC560700864489 /* CueSheetPropertiesReader.m */; };
|
||||||
8D5B49B0048680CD000E48DA /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C167DFE841241C02AAC07 /* InfoPlist.strings */; };
|
8D5B49B0048680CD000E48DA /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C167DFE841241C02AAC07 /* InfoPlist.strings */; };
|
||||||
8D5B49B4048680CD000E48DA /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7ADFEA557BF11CA2CBB /* Cocoa.framework */; };
|
8D5B49B4048680CD000E48DA /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7ADFEA557BF11CA2CBB /* Cocoa.framework */; };
|
||||||
|
@ -22,6 +23,8 @@
|
||||||
089C167EFE841241C02AAC07 /* English */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = "<group>"; };
|
089C167EFE841241C02AAC07 /* English */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = "<group>"; };
|
||||||
089C167FFE841241C02AAC07 /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = "<absolute>"; };
|
089C167FFE841241C02AAC07 /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = "<absolute>"; };
|
||||||
1058C7ADFEA557BF11CA2CBB /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = "<absolute>"; };
|
1058C7ADFEA557BF11CA2CBB /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = "<absolute>"; };
|
||||||
|
17DA346C0CC04FCD0003F6B2 /* CueSheetMetadataReader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CueSheetMetadataReader.h; sourceTree = "<group>"; };
|
||||||
|
17DA346D0CC04FCD0003F6B2 /* CueSheetMetadataReader.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CueSheetMetadataReader.m; sourceTree = "<group>"; };
|
||||||
17F3BB660CBC560700864489 /* CueSheetPropertiesReader.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CueSheetPropertiesReader.h; sourceTree = "<group>"; };
|
17F3BB660CBC560700864489 /* CueSheetPropertiesReader.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CueSheetPropertiesReader.h; sourceTree = "<group>"; };
|
||||||
17F3BB670CBC560700864489 /* CueSheetPropertiesReader.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = CueSheetPropertiesReader.m; sourceTree = "<group>"; };
|
17F3BB670CBC560700864489 /* CueSheetPropertiesReader.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = CueSheetPropertiesReader.m; sourceTree = "<group>"; };
|
||||||
32DBCF630370AF2F00C91783 /* CueSheet_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CueSheet_Prefix.pch; sourceTree = "<group>"; };
|
32DBCF630370AF2F00C91783 /* CueSheet_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CueSheet_Prefix.pch; sourceTree = "<group>"; };
|
||||||
|
@ -99,6 +102,8 @@
|
||||||
8E8D424C0CBB11C600135C1B /* CueSheet.m */,
|
8E8D424C0CBB11C600135C1B /* CueSheet.m */,
|
||||||
8E8D43550CBB1AE900135C1B /* CueSheetTrack.h */,
|
8E8D43550CBB1AE900135C1B /* CueSheetTrack.h */,
|
||||||
8E8D43560CBB1AE900135C1B /* CueSheetTrack.m */,
|
8E8D43560CBB1AE900135C1B /* CueSheetTrack.m */,
|
||||||
|
17DA346C0CC04FCD0003F6B2 /* CueSheetMetadataReader.h */,
|
||||||
|
17DA346D0CC04FCD0003F6B2 /* CueSheetMetadataReader.m */,
|
||||||
);
|
);
|
||||||
name = Classes;
|
name = Classes;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
|
@ -195,6 +200,7 @@
|
||||||
8E8D424D0CBB11C600135C1B /* CueSheet.m in Sources */,
|
8E8D424D0CBB11C600135C1B /* CueSheet.m in Sources */,
|
||||||
8E8D43570CBB1AE900135C1B /* CueSheetTrack.m in Sources */,
|
8E8D43570CBB1AE900135C1B /* CueSheetTrack.m in Sources */,
|
||||||
17F3BB680CBC560700864489 /* CueSheetPropertiesReader.m in Sources */,
|
17F3BB680CBC560700864489 /* CueSheetPropertiesReader.m in Sources */,
|
||||||
|
17DA346E0CC04FCD0003F6B2 /* CueSheetMetadataReader.m in Sources */,
|
||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
};
|
};
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
#import "CueSheetContainer.h"
|
#import "CueSheetContainer.h"
|
||||||
#import "CueSheetDecoder.h"
|
#import "CueSheetDecoder.h"
|
||||||
#import "CueSheetPropertiesReader.h"
|
#import "CueSheetPropertiesReader.h"
|
||||||
|
#import "CueSheetMetadataReader.h"
|
||||||
|
|
||||||
@implementation CueSheetPlugin
|
@implementation CueSheetPlugin
|
||||||
|
|
||||||
|
@ -20,6 +21,7 @@
|
||||||
kCogContainer, [CueSheetContainer className],
|
kCogContainer, [CueSheetContainer className],
|
||||||
kCogDecoder, [CueSheetDecoder className],
|
kCogDecoder, [CueSheetDecoder className],
|
||||||
kCogPropertiesReader, [CueSheetPropertiesReader className],
|
kCogPropertiesReader, [CueSheetPropertiesReader className],
|
||||||
|
kCogMetadataReader, [CueSheetMetadataReader className],
|
||||||
nil];
|
nil];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,15 +13,26 @@
|
||||||
NSString *track;
|
NSString *track;
|
||||||
NSURL *url;
|
NSURL *url;
|
||||||
|
|
||||||
|
NSString *artist;
|
||||||
|
NSString *album;
|
||||||
|
NSString *title;
|
||||||
|
NSString *genre;
|
||||||
|
NSString *year;
|
||||||
|
|
||||||
double time;
|
double time;
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (id)trackWithURL:(NSURL *)u track:(NSString *)t time:(double)t;
|
+ (id)trackWithURL:(NSURL *)u track:(NSString *)t time:(double)s artist:(NSString *)a album:(NSString *)b title:(NSString *)l genre:(NSString *)g year:(NSString *)y;
|
||||||
- (id)initWithURL:(NSURL *)u track:(NSString *)t time:(double)t;
|
- (id)initWithURL:(NSURL *)u track:(NSString *)t time:(double)s artist:(NSString *)a album:(NSString *)b title:(NSString *)l genre:(NSString *)g year:(NSString *)y;
|
||||||
|
|
||||||
|
|
||||||
- (NSString *)track;
|
- (NSString *)track;
|
||||||
- (NSURL *)url;
|
- (NSURL *)url;
|
||||||
|
- (NSString *)artist;
|
||||||
|
- (NSString *)album;
|
||||||
|
- (NSString *)title;
|
||||||
|
- (NSString *)genre;
|
||||||
|
- (NSString *)year;
|
||||||
|
|
||||||
- (double)time;
|
- (double)time;
|
||||||
|
|
||||||
|
|
|
@ -11,18 +11,24 @@
|
||||||
|
|
||||||
@implementation CueSheetTrack
|
@implementation CueSheetTrack
|
||||||
|
|
||||||
+ (id)trackWithURL:(NSURL *)u track:(NSString *)t time:(double)s
|
+ (id)trackWithURL:(NSURL *)u track:(NSString *)t time:(double)s artist:(NSString *)a album:(NSString *)b title:(NSString *)l genre:(NSString *)g year:(NSString *)y
|
||||||
{
|
{
|
||||||
return [[[CueSheetTrack alloc] initWithURL:u track:t time:s] autorelease];
|
return [[[CueSheetTrack alloc] initWithURL:u track:t time:s artist:a album:b title:l genre:g year:y] autorelease];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (id)initWithURL:(NSURL *)u track:(NSString *)t time:(double)s
|
- (id)initWithURL:(NSURL *)u track:(NSString *)t time:(double)s artist:(NSString *)a album:(NSString *)b title:(NSString *)l genre:(NSString *)g year:(NSString *)y
|
||||||
{
|
{
|
||||||
self = [super init];
|
self = [super init];
|
||||||
if (self)
|
if (self)
|
||||||
{
|
{
|
||||||
track = [t copy];
|
track = [t copy];
|
||||||
url = [u copy];
|
url = [u copy];
|
||||||
|
artist = [a copy];
|
||||||
|
album = [b copy];
|
||||||
|
title = [l copy];
|
||||||
|
genre = [g copy];
|
||||||
|
year = [y copy];
|
||||||
|
|
||||||
time = s;
|
time = s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,4 +50,30 @@
|
||||||
return time;
|
return time;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (NSString *)artist
|
||||||
|
{
|
||||||
|
return artist;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (NSString *)album
|
||||||
|
{
|
||||||
|
return album;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (NSString *)title
|
||||||
|
{
|
||||||
|
return title;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (NSString *)genre
|
||||||
|
{
|
||||||
|
return genre;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (NSString *)year
|
||||||
|
{
|
||||||
|
return year;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
Loading…
Reference in New Issue