+ return [[ITAppleEventCenter sharedCenter]
+ sendTwoTierAEWithRequestedKeyForNumber:@"pRte" fromObjectByKey:@"pTrk" eventClass:@"core" eventID:@"getd" appPSN:[self iTunesPSN]] / 100.0;
+}
+
+- (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:'prop', want:type('prop'), seld:type('pPla'), from:'null'() } } }",(long)(rating*100),[self currentSongIndex]] eventClass:@"core" eventID:@"setd" appPSN:[self iTunesPSN]];
+ return YES;
+}
+
+/* - (BOOL)equalizerEnabled
+{
+ int thingy = [[ITAppleEventCenter sharedCenter] sendAEWithSendStringForNumber:@"'----':obj { form:type('prop'), want:type('prop'), seld:type('pEQ '), from:() }" eventClass:@"core" eventID:@"getd" appPSN:[self iTunesPSN]];
+ NSLog(@"Debug equalizerEnabled: %i", thingy);
+ return thingy;
+}
+
+- (BOOL)setEqualizerEnabled:(BOOL)enabled
+{
+ [[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:[self iTunesPSN]];
+ return YES;
+} */
+
+- (NSArray *)eqPresets
+{
+ int i;
+ long numPresets = [[ITAppleEventCenter sharedCenter] sendAEWithSendStringForNumber:@"kocl:type('cEQP'), '----':(), &subj:()" eventClass:@"core" eventID:@"cnte" appPSN:[self iTunesPSN]];
+ NSMutableArray *presets = [[NSMutableArray alloc] initWithCapacity:numPresets];
+
+ for (i = 1; i <= numPresets; i++) {
+ NSString *theObj = [[ITAppleEventCenter sharedCenter] sendAEWithSendString:[NSString stringWithFormat:@"'----':obj { form:'prop', want:type('prop'), seld:type('pnam'), from:obj { form:'indx', want:type('cEQP'), seld:long(%lu), from:'null'() } }",i] eventClass:@"core" eventID:@"getd" appPSN:[self iTunesPSN]];
+ if (theObj) {
+ [presets addObject:theObj];
+ }
+ }
+ return [presets autorelease];
+}
+
+- (int)currentEQPresetIndex
+{
+ int result;
+ result = [[ITAppleEventCenter sharedCenter]
+ sendTwoTierAEWithRequestedKeyForNumber:@"pidx" fromObjectByKey:@"pEQP" eventClass:@"core" eventID:@"getd" appPSN:[self iTunesPSN]];
+ return result;
+}
+
+- (float)volume
+{
+ long vol = [[ITAppleEventCenter sharedCenter] sendAEWithRequestedKeyForNumber:@"pVol" eventClass:@"core" eventID:@"getd" appPSN:[self iTunesPSN]];
+ return vol / 100;
+}
+
+- (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:[self iTunesPSN]];
+ return NO;
+}
+
+- (BOOL)shuffleEnabled
+{
+ int result = [[ITAppleEventCenter sharedCenter]
+ sendTwoTierAEWithRequestedKeyForNumber:@"pShf" fromObjectByKey:@"pPla" eventClass:@"core" eventID:@"getd" appPSN:[self 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:[self iTunesPSN]];
+ return YES;
+}
+
+- (ITMTRemotePlayerRepeatMode)repeatMode
+{
+ FourCharCode m00f = 0;
+ int result = 0;
+ m00f = [[ITAppleEventCenter sharedCenter]
+ sendTwoTierAEWithRequestedKeyForNumber:@"pRpt" fromObjectByKey:@"pPla" eventClass:@"core" eventID:@"getd" appPSN:[self 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 = 0;
+ 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:[self iTunesPSN]];
+ return YES;