- 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];
+ 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];
+ }
+ }
+ menuItem = [[NSMenuItem alloc] initWithTitle:[NSString stringWithFormat:@" %@", curSongName]
+ action:nil
+ keyEquivalent:@""];
+ [menu insertItem:menuItem atIndex:trackInfoIndex + 1];