X-Git-Url: http://git.ithinksw.org/MenuTunes.git/blobdiff_plain/53a760dd8d1249f4e4cbcabb4c07efdfcb29ba2d..beebd024ae0457a22ab8f289f890ead9f6db399e:/iTunesRemote.m diff --git a/iTunesRemote.m b/iTunesRemote.m index a741164..5108701 100755 --- a/iTunesRemote.m +++ b/iTunesRemote.m @@ -26,12 +26,14 @@ { ITDebugLog(@"iTunesRemote begun"); savedPSN = [self iTunesPSN]; + [[NSDistributedNotificationCenter defaultCenter] addObserver:self selector:@selector(notificationHandler:) name:@"com.apple.iTunes.playerInfo" object:@"com.apple.iTunes.player"]; return YES; } - (BOOL)halt { ITDebugLog(@"iTunesRemote halted"); + [[NSDistributedNotificationCenter defaultCenter] removeObserver:self]; return YES; } @@ -822,6 +824,13 @@ return ([ITSendAEWithString(@"'----':obj { form:'prop', want:type('prop'), seld:type('pcls'), from:obj { form:'prop', want:type('prop'), seld:type('pTrk'), from:'null'() } }", 'core', 'getd', &savedPSN) int32Value] != 'prop'); } +- (void)notificationHandler:(NSNotification *)note +{ + ITDebugLog(@"Received notification: %@", note); + [[NSNotificationCenter defaultCenter] postNotificationName:@"ITMTTrackChanged" object:self userInfo:[note userInfo]]; + ITDebugLog(@"Handled notification."); +} + - (ProcessSerialNumber)iTunesPSN { /*NSArray *apps = [[NSWorkspace sharedWorkspace] launchedApplications];