- (void)timerUpdate
{
- if ( [self songChanged] && (timerUpdating != YES) && (playerRunningState == ITMTRemotePlayerRunning) ) {
+ if ([[self currentRemote] playerStateUniqueIdentifier] == nil) {
+ [statusItem setEnabled:NO];
+ [statusItem setToolTip:@"iTunes not responding."];
+ return;
+ } else if (![statusItem isEnabled]) {
+ [statusItem setEnabled:YES];
+ [statusItem setToolTip:_toolTip];
+ return;
+ }
+
+ if ( [self songChanged] && (timerUpdating != YES) && (playerRunningState == ITMTRemotePlayerRunning) ) {
ITDebugLog(@"The song changed.");
-
if ([df boolForKey:@"runScripts"]) {
NSArray *scripts = [[NSFileManager defaultManager] directoryContentsAtPath:[NSHomeDirectory() stringByAppendingPathComponent:@"Library/Application Support/MenuTunes/Scripts"]];
NSEnumerator *scriptsEnum = [scripts objectEnumerator];
if ( [df boolForKey:@"showToolTip"] ) {
NSString *artist = [[self currentRemote] currentSongArtist];
NSString *title = [[self currentRemote] currentSongTitle];
- NSString *toolTip;
ITDebugLog(@"Creating status item tooltip.");
if (artist) {
- toolTip = [NSString stringWithFormat:@"%@ - %@", artist, title];
+ _toolTip = [NSString stringWithFormat:@"%@ - %@", artist, title];
} else if (title) {
- toolTip = title;
+ _toolTip = title;
} else {
- toolTip = @"No Song Playing";
+ _toolTip = @"No Song Playing";
}
- [statusItem setToolTip:toolTip];
+ [statusItem setToolTip:_toolTip];
} else {
[statusItem setToolTip:nil];
}
[self timerUpdate];
}
+- (void)makePlaylistWithTerm:(NSString *)term ofType:(int)type
+{
+ ITDebugLog(@"Making playlist with term %@, type %i", term, type);
+ NS_DURING
+ [[self currentRemote] makePlaylistWithTerm:term ofType:type];
+ NS_HANDLER
+ [self networkError:localException];
+ NS_ENDHANDLER
+ ITDebugLog(@"Done making playlist");
+}
+
- (void)showPlayer
{
ITDebugLog(@"Beginning show player.");
}
}
- if ( [df boolForKey:@"showPlayCount"] && ![self radioIsPlaying] ) {
+ if ( [df boolForKey:@"showPlayCount"] && ![self radioIsPlaying] && [[self currentRemote] currentSource] == ITMTRemoteLibrarySource ) {
NS_DURING
playCount = [[self currentRemote] currentSongPlayCount];
NS_HANDLER
- (void)popupMenu
{
if (!_popped) {
- NSMenu *menu = [menuController menu];
_popped = YES;
+ [self menuClicked];
+ NSMenu *menu = [statusItem menu];
[(NSCarbonMenuImpl *)[menu _menuImpl] popUpMenu:menu atLocation:[NSEvent mouseLocation] width:1 forView:nil withSelectedItem:-30 withFont:[NSFont menuFontOfSize:32]];
_popped = NO;
}