X-Git-Url: http://git.ithinksw.org/MenuTunes.git/blobdiff_plain/f259f879db5bb904afca6f0fa31effa5511c476e..d0f7f088df5abfd00ae716cf2c1d17ae21d0842b:/MainController.m diff --git a/MainController.m b/MainController.m index 40f50ce..157b97a 100755 --- a/MainController.m +++ b/MainController.m @@ -357,7 +357,21 @@ static MainController *sharedController; - (void)timerUpdate { - if ( [self songChanged] && (timerUpdating != YES) && (playerRunningState == ITMTRemotePlayerRunning) ) { + if ([[self currentRemote] playerStateUniqueIdentifier] == nil) { + if ([statusItem isEnabled]) { + [statusItem setToolTip:@"iTunes not responding."]; + [self clearHotKeys]; + } + [statusItem setEnabled:NO]; + return; + } else if (![statusItem isEnabled]) { + [statusItem setEnabled:YES]; + [statusItem setToolTip:_toolTip]; + [self setupHotKeys]; + 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"]]; @@ -392,16 +406,15 @@ static MainController *sharedController; 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]; }