mamburu: Display track titles from cue in file tree

CQTexperiment
Chris Moeller 2013-10-11 05:45:08 -07:00
parent 06378252c0
commit eab60596eb
1 changed files with 20 additions and 1 deletions

View File

@ -7,6 +7,7 @@
// //
#import "ContainedNode.h" #import "ContainedNode.h"
#import "CogAudio/AudioMetadataReader.h"
@implementation ContainedNode @implementation ContainedNode
@ -23,7 +24,25 @@
if ([u fragment]) if ([u fragment])
{ {
[display release]; [display release];
display = [[u fragment] retain]; NSDictionary *metadata = [AudioMetadataReader metadataForURL:u];
NSString *title = nil;
NSString *artist = nil;
if (metadata)
{
title = [metadata valueForKey:@"title"];
artist = [metadata valueForKey:@"artist"];
}
if (title && [title length])
{
if (artist && [artist length]) { display = [[u fragment] stringByAppendingFormat:@": %@ - %@", artist, title];}
else { display = [[u fragment] stringByAppendingFormat:@": %@", title]; }
[display retain];
}
else
{
display = [[u fragment] retain];
}
} }
} }