X-Git-Url: http://git.ithinksw.org/MenuTunes.git/blobdiff_plain/c9a21871b37d415af1d0723715c43bbfae86c25a..a39da95b62217faccd6f43d22f20c5637cf10196:/MainController.m diff --git a/MainController.m b/MainController.m index 4c2ed2c..b041679 100755 --- a/MainController.m +++ b/MainController.m @@ -14,7 +14,6 @@ - (ITMTRemote *)loadRemote; - (void)timerUpdate; - (void)setLatestSongIdentifier:(NSString *)newIdentifier; -- (void)showCurrentTrackInfo; - (void)applicationLaunched:(NSNotification *)note; - (void)applicationTerminated:(NSNotification *)note; @end @@ -407,7 +406,7 @@ static MainController *sharedController; { ITDebugLog(@"Selecting playlist %i", index); NS_DURING - [[self currentRemote] switchToPlaylistAtIndex:index]; + [[self currentRemote] switchToPlaylistAtIndex:(index / 1000) ofSourceAtIndex:(index % 1000)]; NS_HANDLER [self networkError:localException]; NS_ENDHANDLER @@ -500,6 +499,10 @@ static MainController *sharedController; - (ITMTRemote *)currentRemote { + if ([networkController isConnectedToServer] && ![[networkController networkObject] isValid]) { + [self networkError:nil]; + return nil; + } return currentRemote; } @@ -998,7 +1001,7 @@ static MainController *sharedController; if ([networkController checkForServerAtHost:[df stringForKey:@"sharedPlayerHost"]]) { ITDebugLog(@"Remote server found."); [timer invalidate]; - if (![networkController isConnectedToServer]) { + if (![networkController isServerOn] && ![networkController isConnectedToServer]) { [[StatusWindowController sharedController] showReconnectQueryWindow]; } } else { @@ -1009,8 +1012,7 @@ static MainController *sharedController; - (void)networkError:(NSException *)exception { ITDebugLog(@"Remote exception thrown: %@: %@", [exception name], [exception reason]); - NSLog(@"%@", [exception reason]); - if ([[exception name] isEqualToString:NSPortTimeoutException] && [networkController isConnectedToServer]) { + if ( ((exception == nil) || [[exception name] isEqualToString:NSPortTimeoutException]) && [networkController isConnectedToServer]) { NSRunCriticalAlertPanel(@"Remote MenuTunes Disconnected", @"The MenuTunes server you were connected to stopped responding or quit. MenuTunes will revert back to the local player.", @"OK", nil, nil); if ([self disconnectFromServer]) { [[PreferencesController sharedPrefs] resetRemotePlayerTextFields];