X-Git-Url: http://git.ithinksw.org/MenuTunes.git/blobdiff_plain/64c4e21e6550d32210f20393d1d8249d7947bc71..304ae643ec373b72dd98ad1cf52f09478e639a8b:/iTunesRemote.m?ds=inline diff --git a/iTunesRemote.m b/iTunesRemote.m index 7ab8dfd..5ec512b 100755 --- a/iTunesRemote.m +++ b/iTunesRemote.m @@ -69,6 +69,19 @@ nil]; } +- (BOOL)showPrimaryInterface +{ + // Make this into AppleEvents... shouldn't be too hard, I'm just too tired to do it right now. + //tell application "iTunes" + // set frontmost to true + // set visible of browser window 1 to true + // set minimized of browser window 1 to false + // set view of browser window 1 to (playlist (index of current playlist)) + //end tell + //Someone do this plz kthx + return NO; +} + - (ITMTRemotePlayerRunningState)playerRunningState { NSArray *apps = [[NSWorkspace sharedWorkspace] launchedApplications]; @@ -133,7 +146,8 @@ switch (realResult) { case 'cLiP': - return ITRemotePlayerLibraryPlaylist; + return ITMTRemotePlayerLibraryPlaylist; + break; case 'cRTP': return ITMTRemotePlayerRadioPlaylist; break; @@ -152,6 +166,11 @@ return [[ITAppleEventCenter sharedCenter] sendAEWithSendString:[NSString stringWithFormat:@"'----':obj { form:'prop', want:type('prop'), seld:type('pnam'), from:obj { form:'indx', want:type('cTrk'), seld:long(%lu), from:obj { form:'prop', want:type('prop'), seld:type('pPla'), from:'null'() } } }",index] eventClass:@"core" eventID:@"getd" appPSN:iTunesPSN]; } +- (NSString *)currentSongUniqueIdentifier +{ + return @"BBQ"; +} + - (int)currentSongIndex { return [[ITAppleEventCenter sharedCenter] sendTwoTierAEWithRequestedKeyForNumber:@"pidx" fromObjectByKey:@"pTrk" eventClass:@"core" eventID:@"getd" appPSN:iTunesPSN]; @@ -200,19 +219,19 @@ - (BOOL)setCurrentSongRating:(float)rating { - [[ITAppleEventCenter sharedCenter] sendAEWithSendString:[NSString stringWithFormat:@"data:long(%lu), ----:obj { form:'prop', want:type('prop'), seld:type('pRte'), from:obj { form:'indx', want:type('cTrk'), seld:long(%lu), from:obj { form:'indx', want:type('cPly'), seld:long(%lu), from:'null'() } } }",(long)rating*100,[self currentSongIndex],[self currentPlaylistIndex]] eventClass:@"core" eventID:@"setd" appPSN:iTunesPSN]; + [[ITAppleEventCenter sharedCenter] sendAEWithSendString:[NSString stringWithFormat:@"data:long(%lu), '----':obj { form:'prop', want:type('prop'), seld:type('pRte'), from:obj { form:'indx', want:type('cTrk'), seld:long(%lu), from:obj { form:'prop', want:type('prop'), seld:type('pPla'), from:'null'() } } }",(long)(rating*100),[self currentSongIndex]] eventClass:@"core" eventID:@"setd" appPSN:iTunesPSN]; return YES; } - (BOOL)equalizerEnabled { - return [[ITAppleEventCenter sharedCenter] - sendAEWithRequestedKeyForNumber:@"pEQ " eventClass:@"core" eventID:@"getd" appPSN:iTunesPSN]; + return [[ITAppleEventCenter sharedCenter] sendAEWithSendStringForNumber:@"'----':obj { form:type('prop'), want:type('prop'), seld:type('pEQ '), from:() }" eventClass:@"core" eventID:@"getd" appPSN:iTunesPSN]; + } - (BOOL)setEqualizerEnabled:(BOOL)enabled { -[[ITAppleEventCenter sharedCenter] sendAEWithSendString:[NSString stringWithFormat:@"data:long(%lu) ----:obj { form:'prop', want:type('prop'), seld:type('pEQ '), from:obj { form:'prop', want:type('prop'), seld:type('pPla'), from:'null'() } }",enabled] eventClass:@"core" eventID:@"setd" appPSN:iTunesPSN]; +[[ITAppleEventCenter sharedCenter] sendAEWithSendString:[NSString stringWithFormat:@"data:long(%lu), '----':obj { form:'prop', want:type('prop'), seld:type('pEQ '), from:'null'() }",enabled] eventClass:@"core" eventID:@"setd" appPSN:iTunesPSN]; } - (NSArray *)eqPresets @@ -246,7 +265,7 @@ - (BOOL)setVolume:(float)volume { - [[ITAppleEventCenter sharedCenter] sendAEWithSendString:[NSString stringWithFormat:@"data:long(%lu), ----:obj { form:'prop', want:type('prop'), seld:type('pVol'), from:'null'() }",(long)volume*100] eventClass:@"core" eventID:@"setd" appPSN:iTunesPSN]; + [[ITAppleEventCenter sharedCenter] sendAEWithSendString:[NSString stringWithFormat:@"data:long(%lu), '----':obj { form:'prop', want:type('prop'), seld:type('pVol'), from:'null'() }",(long)(volume*100)] eventClass:@"core" eventID:@"setd" appPSN:iTunesPSN]; return NO; } @@ -355,7 +374,8 @@ - (BOOL)switchToEQAtIndex:(int)index { - [[ITAppleEventCenter sharedCenter] sendAEWithSendString:[NSString stringWithFormat:@"data:obj { form:'ID ', want:type('cEQP'), seld:long(%lu), from:'null'() }, ----:obj { form:'prop', want:type('prop'), seld:type('pEQP'), from:'null'() }",index] eventClass:@"core" eventID:@"setd" appPSN:iTunesPSN]; + // index should count from 0, but itunes counts from 1, so let's add 1. + [[ITAppleEventCenter sharedCenter] sendAEWithSendString:[NSString stringWithFormat:@"'----':obj { form:'prop', want:type('prop'), seld:type('pEQP'), from:'null'() }, data:obj { form:'indx', want:type('cEQP'), seld:long(%lu), from:'null'() }",(index+1)] eventClass:@"core" eventID:@"setd" appPSN:iTunesPSN]; return YES; }