2007-10-16 01:22:57 +00:00
|
|
|
//
|
|
|
|
// ContainedNode.m
|
|
|
|
// Cog
|
|
|
|
//
|
|
|
|
// Created by Vincent Spader on 10/15/07.
|
|
|
|
// Copyright 2007 __MyCompanyName__. All rights reserved.
|
|
|
|
//
|
|
|
|
|
|
|
|
#import "ContainedNode.h"
|
2013-10-11 12:45:08 +00:00
|
|
|
#import "CogAudio/AudioMetadataReader.h"
|
2007-10-16 01:22:57 +00:00
|
|
|
|
|
|
|
@implementation ContainedNode
|
|
|
|
|
2022-02-07 05:49:27 +00:00
|
|
|
- (BOOL)isLeaf {
|
2007-10-16 01:22:57 +00:00
|
|
|
return YES;
|
|
|
|
}
|
|
|
|
|
2022-02-07 05:49:27 +00:00
|
|
|
- (void)setURL:(NSURL *)u {
|
2007-10-16 01:22:57 +00:00
|
|
|
[super setURL:u];
|
2022-02-07 05:49:27 +00:00
|
|
|
|
|
|
|
if([u fragment]) {
|
|
|
|
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];
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
display = [u fragment];
|
|
|
|
}
|
2007-10-16 01:22:57 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@end
|