From 74db595a2db14d2ef865697e44ae8bdb04a05c32 Mon Sep 17 00:00:00 2001 From: Chris Moeller Date: Fri, 11 Oct 2013 05:48:19 -0700 Subject: [PATCH] mamburu: Better titles for game music containers --- Plugins/GME/GameMetadataReader.m | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/Plugins/GME/GameMetadataReader.m b/Plugins/GME/GameMetadataReader.m index 5bf541135..68de4e8f7 100644 --- a/Plugins/GME/GameMetadataReader.m +++ b/Plugins/GME/GameMetadataReader.m @@ -81,10 +81,18 @@ gme_delete(emu); - NSDictionary * dict = [NSDictionary dictionaryWithObjectsAndKeys: + NSString *title = [NSString stringWithUTF8String: info->song]; + if (!title || ![title length]) + { + // this is needed to distinguish between different tracks in NSF, for example + // otherwise they will all be displayed as 'blahblah.nsf' in playlist + title = [[url lastPathComponent] stringByAppendingFormat:@" [%d]", track_num]; + } + + NSDictionary * dict = [NSDictionary dictionaryWithObjectsAndKeys: [NSString stringWithUTF8String: info->system], @"genre", [NSString stringWithUTF8String: info->game], @"album", - [NSString stringWithUTF8String: info->song], @"title", + title, @"title", [NSString stringWithUTF8String: info->author], @"artist", [NSNumber numberWithInt:track_num+1], @"track", nil];