X-Git-Url: http://git.ithinksw.org/MenuTunes.git/blobdiff_plain/154ddd8b39891b174082df48f504f83d0a6a22d9..28ef52fed0fa8f1d49c604cabe52b846bf01d393:/iTunesRemote.m diff --git a/iTunesRemote.m b/iTunesRemote.m index c7d17a8..3c1ce75 100755 --- a/iTunesRemote.m +++ b/iTunesRemote.m @@ -123,7 +123,7 @@ return ITMTRemotePlayerStopped; } -/*- (NSArray *)playlists +- (NSArray *)playlists { long i = 0; const signed long numPlaylists = [[ITAppleEventCenter sharedCenter] sendAEWithSendStringForNumber:@"kocl:type('cPly'), '----':()" eventClass:@"core" eventID:@"cnte" appPSN:savedPSN]; @@ -136,10 +136,10 @@ [playlists addObject:theObj]; } return [playlists autorelease]; -}*/ +} //Full source awareness -- (NSArray *)playlists +/*- (NSArray *)playlists { unsigned long i,k; const signed long numSources = [[ITAppleEventCenter sharedCenter] sendAEWithSendStringForNumber:@"kocl:type('cSrc'), '----':()" eventClass:@"core" eventID:@"cnte" appPSN:savedPSN]; NSMutableArray *allSources = [[NSMutableArray alloc] init]; @@ -188,7 +188,7 @@ } ITDebugLog(@"Finished getting playlists."); return [NSArray arrayWithArray:[allSources autorelease]]; -} +}*/ - (int)numberOfSongsInPlaylistAtIndex:(int)index { @@ -417,7 +417,17 @@ - (NSImage *)currentSongAlbumArt { - return nil; + NSAppleScript *script; + NSAppleEventDescriptor *moof; + NSData *data; + script = [[NSAppleScript alloc] initWithSource:@"tell application \"iTunes\"\nget data of artwork 1 of current track\nend tell"]; + moof = [script executeAndReturnError:nil]; + data = [moof data]; + if (data) { + return [[[NSImage alloc] initWithData:data] autorelease]; + } else { + return nil; + } } - (float)currentSongRating @@ -626,14 +636,14 @@ return YES; } -- (BOOL)switchToPlaylistAtIndex:(int)index ofSourceAtIndex:(int)index2 +/*- (BOOL)switchToPlaylistAtIndex:(int)index ofSourceAtIndex:(int)index2 { ITDebugLog(@"Switching to playlist at index %i of source %i", index, index2); [[ITAppleEventCenter sharedCenter] sendAEWithSendString:[NSString stringWithFormat:@"'----':obj { form:'indx', want:type('cPly'), seld:long(%lu), from: obj { form:'indx', want:type('cSrc'), seld:long(%lu), from:'null'() } }", index - 1, index2 + 1] eventClass:@"hook" eventID:@"Play" appPSN:savedPSN]; //{ form:'indx', want:type('cPly'), seld:long(%lu), from:obj { form:'indx', want:type('cSrc'), seld:long('%lu'), from:'null'() } } -- obj { form:'indx', want:type('cSrc'), seld:long(1), from:'null'() } ITDebugLog(@"Done switching to playlist at index %i of source %i", index, index2); return YES; -} +}*/ - (BOOL)switchToSongAtIndex:(int)index {