- if ([defaults boolForKey:@"showArtist"]) {
- [menu addItemWithTitle:[NSString stringWithFormat:@" %@", [currentRemote currentSongArtist]]
- action:nil
- keyEquivalent:@""];
- }
-
- if ([defaults boolForKey:@"showTrackNumber"]) {
- [menu addItemWithTitle:[NSString stringWithFormat:@" Track %i", [currentRemote currentSongTrack]]
- action:nil
- keyEquivalent:@""];
- }
-
- if ([defaults boolForKey:@"showTime"]) {
- int left = [[currentRemote currentSongRemaining] intValue];
- NSString *remaining = [NSString stringWithFormat:@"%i:%02i", left / 60, left % 60];
- [menu addItemWithTitle:[NSString stringWithFormat:@" %@/%@", remaining, [currentRemote currentSongLength]]
- action:nil
- keyEquivalent:@""];
+ if (!_playingRadio) {
+ if ([defaults boolForKey:@"showAlbum"]) {
+ NSString *curAlbum = [currentRemote currentSongAlbum];
+ ITDebugLog(@"Add Track Album (\"%@\") menu item.", curAlbum);
+ if ( curAlbum ) {
+ [menu indentItem:
+ [menu addItemWithTitle:curAlbum action:nil keyEquivalent:@""]];
+ }
+ }
+
+ if ([defaults boolForKey:@"showArtist"]) {
+ NSString *curArtist = [currentRemote currentSongArtist];
+ ITDebugLog(@"Add Track Artist (\"%@\") menu item.", curArtist);
+ if ( curArtist ) {
+ [menu indentItem:
+ [menu addItemWithTitle:curArtist action:nil keyEquivalent:@""]];
+ }
+ }
+
+ if ([defaults boolForKey:@"showTrackNumber"]) {
+ int track = [currentRemote currentSongTrack];
+ ITDebugLog(@"Add Track Number (\"Track %i\") menu item.", track);
+ if ( track > 0 ) {
+ [menu indentItem:
+ [menu addItemWithTitle:[NSString stringWithFormat:@"%@ %i", NSLocalizedString(@"track", @"Track"), track] action:nil keyEquivalent:@""]];
+ }
+ }
+
+ if ([defaults boolForKey:@"showTime"] && ( ([currentRemote currentSongElapsed] != nil) || ([currentRemote currentSongLength] != nil) )) {
+ ITDebugLog(@"Add Track Elapsed (\"%@/%@\") menu item.", [currentRemote currentSongElapsed], [currentRemote currentSongLength]);
+ [menu indentItem:[menu addItemWithTitle:[NSString stringWithFormat:@"%@/%@", [currentRemote currentSongElapsed], [currentRemote currentSongLength]] action:nil keyEquivalent:@""]];
+ }
+
+ if ([defaults boolForKey:@"showTrackRating"] && ( [currentRemote currentSongRating] != -1.0 )) {
+ NSString *string = nil;
+ switch ((int)([currentRemote currentSongRating] * 5)) {
+ case 0:
+ string = [NSString stringWithUTF8String:"☆☆☆☆☆"];
+ break;
+ case 1:
+ string = [NSString stringWithUTF8String:"★☆☆☆☆"];
+ break;
+ case 2:
+ string = [NSString stringWithUTF8String:"★★☆☆☆"];
+ break;
+ case 3:
+ string = [NSString stringWithUTF8String:"★★★☆☆"];
+ break;
+ case 4:
+ string = [NSString stringWithUTF8String:"★★★★☆"];
+ break;
+ case 5:
+ string = [NSString stringWithUTF8String:"★★★★★"];
+ break;
+ }
+ ITDebugLog(@"Add Track Rating (\"%@\") menu item.", string);
+ [menu indentItem:[menu addItemWithTitle:string action:nil keyEquivalent:@""]];
+ }