Cog/FileTree/ContainedNode.m
Christopher Snowhill 0832a8ea34 Restore the File Tree, now with a chooser button
Revert "Remove the file tree, as Sandbox does not permit"

This reverts commit 02ec735687.

This also changes how the File Tree choosing works.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-06-30 16:57:51 -07:00

42 lines
858 B
Objective-C

//
// ContainedNode.m
// Cog
//
// Created by Vincent Spader on 10/15/07.
// Copyright 2007 __MyCompanyName__. All rights reserved.
//
#import "ContainedNode.h"
#import "CogAudio/AudioMetadataReader.h"
@implementation ContainedNode
- (BOOL)isLeaf {
return YES;
}
- (void)setURL:(NSURL *)u {
[super setURL:u];
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];
}
}
}
@end