-
- return ITMTRemotePlayerStopped;
-}
-
-- (NSArray *)playlists
-{
- long i = 0;
- const signed long numPlaylists = [[ITAppleEventCenter sharedCenter] sendAEWithSendStringForNumber:@"kocl:type('cPly'), '----':(), &subj:()" eventClass:@"core" eventID:@"cnte" appPSN:iTunesPSN];
- NSMutableArray *playlists = [[NSMutableArray alloc] initWithCapacity:numPlaylists];
-
-
- for (i = 1; i <= numPlaylists; i++) {
- const long j = i;
- NSString *sendStr = [NSString stringWithFormat:@"'----':obj { form:'prop', want:type('prop'), seld:type('pnam'), from:obj { form:'indx', want:type('cPly'), seld:long(%lu), from:'null'() } }",(unsigned long)j];
- NSString *theObj = [[ITAppleEventCenter sharedCenter] sendAEWithSendString:sendStr eventClass:@"core" eventID:@"getd" appPSN:iTunesPSN];
- //NSLog(@"sent event cur %d max %d",i,numPlaylists);
- [playlists addObject:theObj];
- }
- return [playlists autorelease];
-}
-
-- (int)numberOfSongsInPlaylistAtIndex:(int)index
-{
- return [[ITAppleEventCenter sharedCenter] sendAEWithSendStringForNumber:[NSString stringWithFormat:@"kocl:type('cTrk'), '----':obj { form:'indx', want:type('cPly'), seld:long(%lu), from:'null'() }",index] eventClass:@"core" eventID:@"cnte" appPSN:iTunesPSN];
-}
-
-- (NSString *)classOfPlaylistAtIndex:(int)index
-{
- int realResult = [[ITAppleEventCenter sharedCenter]
- sendTwoTierAEWithRequestedKeyForNumber:@"pcls" fromObjectByKey:@"pPla" eventClass:@"core" eventID:@"getd" appPSN:iTunesPSN];
-
- if (realResult == 'cRTP') return @"radio tuner playlist";
- else return @"playlist";
-}
-
-- (int)currentPlaylistIndex
-{
- int result;
- result = [[ITAppleEventCenter sharedCenter]
- sendTwoTierAEWithRequestedKeyForNumber:@"pidx" fromObjectByKey:@"pPla" eventClass:@"core" eventID:@"getd" appPSN:iTunesPSN];
- return result;
-}
-
-- (NSString *)songTitleAtIndex:(int)index
-{
- 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];
-}
-
-- (int)currentSongIndex
-{
- int result;
- result = [[ITAppleEventCenter sharedCenter] sendTwoTierAEWithRequestedKeyForNumber:@"pidx" fromObjectByKey:@"pTrk" eventClass:@"core" eventID:@"getd" appPSN:iTunesPSN];
- return result;
-}
-
-- (NSString *)currentSongTitle
-{
- return [[ITAppleEventCenter sharedCenter] sendTwoTierAEWithRequestedKey:@"pnam" fromObjectByKey:@"pTrk" eventClass:@"core" eventID:@"getd" appPSN:iTunesPSN];
-}
-
-- (NSString *)currentSongArtist
-{
- return [[ITAppleEventCenter sharedCenter] sendTwoTierAEWithRequestedKey:@"pArt" fromObjectByKey:@"pTrk" eventClass:@"core" eventID:@"getd" appPSN:iTunesPSN];
-}
-
-- (NSString *)currentSongAlbum
-{
- return [[ITAppleEventCenter sharedCenter] sendTwoTierAEWithRequestedKey:@"pAlb" fromObjectByKey:@"pTrk" eventClass:@"core" eventID:@"getd" appPSN:iTunesPSN];
-}
-
-- (NSString *)currentSongGenre
-{
- return [[ITAppleEventCenter sharedCenter] sendTwoTierAEWithRequestedKey:@"pGen" fromObjectByKey:@"pTrk" eventClass:@"core" eventID:@"getd" appPSN:iTunesPSN];
-}
-
-- (NSString *)currentSongLength
-{
- return [[ITAppleEventCenter sharedCenter] sendTwoTierAEWithRequestedKey:@"pTim" fromObjectByKey:@"pTrk" eventClass:@"core" eventID:@"getd" appPSN:iTunesPSN];
-}
-
-- (NSString *)currentSongRemaining
-{
- long duration = [[ITAppleEventCenter sharedCenter]
- sendTwoTierAEWithRequestedKeyForNumber:@"pDur" fromObjectByKey:@"pTrk" eventClass:@"core" eventID:@"getd" appPSN:iTunesPSN];
- long current = [[ITAppleEventCenter sharedCenter]
- sendAEWithRequestedKeyForNumber:@"pPos" eventClass:@"core" eventID:@"getd" appPSN:iTunesPSN];
-
- return [[NSNumber numberWithLong:duration - current] stringValue];