+ if ([curSongName length] > 0) {
+ int index = [menu indexOfItemWithTitle:@"Now Playing"];
+ if (index > -1) {
+ if ([defaults boolForKey:@"showName"]) {
+ [menu removeItemAtIndex:index + 1];
+ }
+ if (didHaveAlbumName) {
+ [menu removeItemAtIndex:index + 1];
+ }
+ if (didHaveArtistName) {
+ [menu removeItemAtIndex:index + 1];
+ }
+ if ([defaults boolForKey:@"showTime"]) {
+ [menu removeItemAtIndex:index + 1];
+ }
+ }
+ if (!isPlayingRadio) {
+ if ([defaults boolForKey:@"showTime"]) {
+ menuItem = [[NSMenuItem alloc] initWithTitle:[NSString stringWithFormat:@" %@", [self runScriptAndReturnResult:@"return time of current track"]]
+ action:nil
+ keyEquivalent:@""];
+ [menu insertItem:menuItem atIndex:trackInfoIndex + 1];
+ [menuItem release];
+ }
+
+ if ([curArtistName length] > 0) {
+ menuItem = [[NSMenuItem alloc] initWithTitle:[NSString stringWithFormat:@" %@", curArtistName]
+ action:nil
+ keyEquivalent:@""];
+ [menu insertItem:menuItem atIndex:trackInfoIndex + 1];
+ [menuItem release];
+ }
+
+ if ([curAlbumName length] > 0) {
+ menuItem = [[NSMenuItem alloc] initWithTitle:[NSString stringWithFormat:@" %@", curAlbumName]
+ action:nil
+ keyEquivalent:@""];
+ [menu insertItem:menuItem atIndex:trackInfoIndex + 1];
+ [menuItem release];
+ }
+ }
+
+ if ([defaults boolForKey:@"showName"]) {
+ menuItem = [[NSMenuItem alloc] initWithTitle:[NSString stringWithFormat:@" %@", curSongName]
+ action:nil
+ keyEquivalent:@""];
+ [menu insertItem:menuItem atIndex:trackInfoIndex + 1];
+ [menuItem release];
+ }
+
+ if (index == -1) {
+ menuItem = [[NSMenuItem alloc] initWithTitle:@"Now Playing" action:nil keyEquivalent:@""];
+ [menu removeItemAtIndex:[menu indexOfItemWithTitle:@"No Song"]];
+ [menu insertItem:menuItem atIndex:trackInfoIndex];
+ [menuItem release];
+ }
+ } else if ([menu indexOfItemWithTitle:@"No Song"] == -1) {
+ [menu removeItemAtIndex:trackInfoIndex];
+
+ if ([defaults boolForKey:@"showName"] == YES) {
+ [menu removeItemAtIndex:trackInfoIndex];
+ }
+
+ if ([defaults boolForKey:@"showTime"] == YES) {
+ [menu removeItemAtIndex:trackInfoIndex];
+ }
+
+ if (didHaveArtistName && [defaults boolForKey:@"showArtist"]) {
+ [menu removeItemAtIndex:trackInfoIndex];
+ }
+
+ if (didHaveAlbumName && [defaults boolForKey:@"showAlbum"]) {
+ [menu removeItemAtIndex:trackInfoIndex];
+ }
+
+ menuItem = [[NSMenuItem alloc] initWithTitle:@"No Song" action:nil keyEquivalent:@""];