-- (BOOL)shuffleEnabled
-{
- int result = [[ITAppleEventCenter sharedCenter]
- sendTwoTierAEWithRequestedKeyForNumber:@"pShf" fromObjectByKey:@"pPla" eventClass:@"core" eventID:@"getd" appPSN:iTunesPSN];
- return result;
-}
-
-- (BOOL)setShuffleEnabled:(BOOL)enabled
-{
- [[ITAppleEventCenter sharedCenter] sendAEWithSendString:[NSString stringWithFormat:@"data:long(%lu) ----:obj { form:'prop', want:type('prop'), seld:type('pShf'), from:obj { form:'prop', want:type('prop'), seld:type('pPla'), from:'null'() } }",enabled] eventClass:@"core" eventID:@"setd" appPSN:iTunesPSN];
-}
-
-- (ITMTRemotePlayerRepeatMode)repeatMode
-{
- FourCharCode m00f;
- int result;
- m00f = [[ITAppleEventCenter sharedCenter]
- sendTwoTierAEWithRequestedKeyForNumber:@"pRpt" fromObjectByKey:@"pPla" eventClass:@"core" eventID:@"getd" appPSN:iTunesPSN];
-
- switch (m00f)
- {
- case 'kRp0':
- result = ITMTRemotePlayerRepeatOff;
- break;
- case 'kRp1':
- result = ITMTRemotePlayerRepeatOne;
- break;
- case 'kRpA':
- result = ITMTRemotePlayerRepeatAll;
- break;
- }
-
- return result;
-}
-
-- (BOOL)setRepeatMode:(ITMTRemotePlayerRepeatMode)repeatMode
-{
- FourCharCode m00f;
- switch (repeatMode)
- {
- case ITMTRemotePlayerRepeatOff:
- m00f = 'kRp0';
- break;
- case ITMTRemotePlayerRepeatOne:
- m00f = 'kRp1';
- break;
- case ITMTRemotePlayerRepeatAll:
- m00f = 'kRpA';
- break;
- }
-
- [[ITAppleEventCenter sharedCenter] sendAEWithSendString:[NSString stringWithFormat:@"data:long(%lu) ----:obj { form:'prop', want:type('pRpt'), seld:type('pShf'), from:obj { form:'prop', want:type('prop'), seld:type('pPla'), from:'null'() } }",m00f] eventClass:@"core" eventID:@"setd" appPSN:iTunesPSN];
-
-}
-
-- (BOOL)play
-{
- [[ITAppleEventCenter sharedCenter] sendAEWithEventClass:@"hook" eventID:@"Play" appPSN:iTunesPSN];
- return YES;
-}
-
-- (BOOL)pause
-{
- [[ITAppleEventCenter sharedCenter] sendAEWithEventClass:@"hook" eventID:@"Paus" appPSN:iTunesPSN];
- return YES;
-}
-
-- (BOOL)goToNextSong
-{
- [[ITAppleEventCenter sharedCenter] sendAEWithEventClass:@"hook" eventID:@"Next" appPSN:iTunesPSN];
- return YES;
-}
-
-- (BOOL)goToPreviousSong
-{
- [[ITAppleEventCenter sharedCenter] sendAEWithEventClass:@"hook" eventID:@"Prev" appPSN:iTunesPSN];
- return YES;
-}
-
-- (BOOL)forward
-{
- [[ITAppleEventCenter sharedCenter] sendAEWithEventClass:@"hook" eventID:@"Fast" appPSN:iTunesPSN];
- return YES;
-}
-
-- (BOOL)rewind
-{
- [[ITAppleEventCenter sharedCenter] sendAEWithEventClass:@"hook" eventID:@"Rwnd" appPSN:iTunesPSN];
- return YES;
-}
-
-- (BOOL)switchToPlaylistAtIndex:(int)index
-{
- [[ITAppleEventCenter sharedCenter] sendAEWithSendString:[NSString stringWithFormat:@"'----':obj { form:'indx', want:type('cPly'), seld:long(%lu), from:() }",index] eventClass:@"hook" eventID:@"Play" appPSN:iTunesPSN];
- return YES;
-}
-
-- (BOOL)switchToSongAtIndex:(int)index
-{
- [[ITAppleEventCenter sharedCenter] sendAEWithSendString:[NSString stringWithFormat:@"'----':obj { form:'indx', want:type('cTrk'), seld:long(%lu), from:obj { form:'prop', want:type('prop'), seld:type('pPla'), from:() } }",index] eventClass:@"hook" eventID:@"Play" appPSN:iTunesPSN];
- return YES;
-}
-
-- (BOOL)switchToEQAtIndex:(int)index
-{
- // 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;