+ ITDebugLog(@"Add Track Title (\"%@\") menu item.", title);
+ [menu indentItem:
+ [menu addItemWithTitle:title action:nil keyEquivalent:@""]];
+ }
+
+ if (!_playingRadio) {
+ if ([defaults boolForKey:@"showAlbum"]) {
+ NSString *curAlbum = nil;
+ NS_DURING
+ curAlbum = [mtr currentSongAlbum];
+ NS_HANDLER
+ [[MainController sharedController] networkError:localException];
+ NS_ENDHANDLER
+ ITDebugLog(@"Add Track Album (\"%@\") menu item.", curAlbum);
+ if ( curAlbum ) {
+ [menu indentItem:
+ [menu addItemWithTitle:curAlbum action:nil keyEquivalent:@""]];
+ }
+ }
+
+ if ([defaults boolForKey:@"showArtist"]) {
+ NSString *curArtist = nil;
+ NS_DURING
+ curArtist = [mtr currentSongArtist];
+ NS_HANDLER
+ [[MainController sharedController] networkError:localException];
+ NS_ENDHANDLER
+ ITDebugLog(@"Add Track Artist (\"%@\") menu item.", curArtist);
+ if ( curArtist ) {
+ [menu indentItem:
+ [menu addItemWithTitle:curArtist action:nil keyEquivalent:@""]];
+ }
+ }
+
+ if ([defaults boolForKey:@"showComposer"]) {
+ NSString *curComposer = nil;
+ NS_DURING
+ curComposer = [mtr currentSongComposer];
+ NS_HANDLER
+ [[MainController sharedController] networkError:localException];
+ NS_ENDHANDLER
+ ITDebugLog(@"Add Track Composer (\"%@\") menu item.", curComposer);
+ if ( curComposer ) {
+ [menu indentItem:
+ [menu addItemWithTitle:curComposer action:nil keyEquivalent:@""]];
+ }
+ }
+
+ if ([defaults boolForKey:@"showTrackNumber"]) {
+ int track = 0;
+ NS_DURING
+ track = [mtr currentSongTrack];
+ NS_HANDLER
+ [[MainController sharedController] networkError:localException];
+ NS_ENDHANDLER
+ 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:@""]];
+ }
+ }
+ }
+
+ NS_DURING
+ if ([defaults boolForKey:@"showTime"] && ( ([mtr currentSongElapsed] != nil) || ([mtr currentSongLength] != nil) )) {
+ ITDebugLog(@"Add Track Elapsed (\"%@/%@\") menu item.", [mtr currentSongElapsed], [mtr currentSongLength]);
+ [menu indentItem:[menu addItemWithTitle:[NSString stringWithFormat:@"%@/%@", [mtr currentSongElapsed], [mtr currentSongLength]] action:nil keyEquivalent:@""]];
+ }
+ NS_HANDLER
+ [[MainController sharedController] networkError:localException];
+ NS_ENDHANDLER
+
+ if (!_playingRadio) {
+ NS_DURING
+ if ([defaults boolForKey:@"showPlayCount"]) {
+ [menu indentItem:[menu addItemWithTitle:[NSString stringWithFormat:@"Play Count: %i", [mtr currentSongPlayCount]] action:nil keyEquivalent:@""]];
+ }
+ if ([defaults boolForKey:@"showTrackRating"] && ( [mtr currentSongRating] != -1.0 )) {
+ NSString *string = nil;
+ switch ((int)([mtr 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:@""]];
+ }
+ NS_HANDLER
+ [[MainController sharedController] networkError:localException];
+ NS_ENDHANDLER
+
+ /*if ([tempItem respondsToSelector:@selector(setAttributedTitle:)] && [defaults boolForKey:@"showAlbumArtwork"] && ![[NetworkController sharedController] isConnectedToServer]) {
+ NSImage *image = [mtr currentSongAlbumArt];
+ if (image) {
+ NSSize oldSize, newSize;
+ oldSize = [image size];
+ if (oldSize.width > oldSize.height) newSize = NSMakeSize(110,oldSize.height * (110.0f / oldSize.width));
+ else newSize = NSMakeSize(oldSize.width * (110.0f / oldSize.height),110);
+ image = [[[[NSImage alloc] initWithData:[image TIFFRepresentation]] autorelease] imageScaledSmoothlyToSize:newSize];
+
+ tempItem = [menu addItemWithTitle:@"" action:nil keyEquivalent:@""];
+ NSTextAttachment *attachment = [[[NSTextAttachment alloc] init] autorelease];
+ [[attachment attachmentCell] setImage:image];
+ NSAttributedString *attrString = [NSAttributedString attributedStringWithAttachment:attachment];
+ [tempItem setAttributedTitle:attrString];
+ }
+ }*/