Mass Bug Fixes by The Mastar of L33t, Joe. Ph34r m3.
authorJoseph Spiros <joseph.spiros@ithinksw.com>
Sun, 16 Mar 2003 08:39:46 +0000 (08:39 +0000)
committerJoseph Spiros <joseph.spiros@ithinksw.com>
Sun, 16 Mar 2003 08:39:46 +0000 (08:39 +0000)
iTunesRemote.m

index e286598..5cda1b0 100755 (executable)
 
 - (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
     return NO;
 }
 
 
 - (BOOL)setCurrentSongRating:(float)rating
 {
-    [[ITAppleEventCenter sharedCenter] sendAEWithSendString:[NSString stringWithFormat:@"data:long(%lu) ----:obj { form:'prop', want:type('prop'), seld:type('pRte'), from:obj { form:'prop', want:type('prop'), seld:type('pTrk'), from:'null'() } }",(long)rating*100] 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)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
 
 - (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;
 }
 
 
 - (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;
 }