X-Git-Url: http://git.ithinksw.org/MenuTunes.git/blobdiff_plain/c99066bb8eb3a6f60be746f1ae150390dea4bd51..b5111a52983c34e3d63dd8547a1f259a7cb5edda:/iTunesRemote.m diff --git a/iTunesRemote.m b/iTunesRemote.m index dde194f..b4479a9 100755 --- a/iTunesRemote.m +++ b/iTunesRemote.m @@ -226,6 +226,42 @@ return [allSources autorelease]; } +- (NSArray *)artists +{ + NSAppleEventDescriptor *rawr = ITSendAEWithString(@"'----':obj { form:'prop', want:type('prop'), seld:type('pArt'), from:obj { form:'indx', want:type('cTrk'), seld:abso($616C6C20$), from:obj { form:'indx', want:type('cPly'), seld:long(1), from:obj { form:'indx', want:type('cSrc'), seld:long(1), from:() } } } }", 'core', 'getd', &savedPSN); + int i; + NSMutableArray *array = [[NSMutableArray alloc] init]; + NSArray *returnArray; + for (i = 1; i <= [rawr numberOfItems]; i++) { + NSString *artist = [[rawr descriptorAtIndex:i] stringValue]; + if (artist && [artist length] && ![array containsObject:artist]) { + [array addObject:artist]; + } + } + [array sortUsingSelector:@selector(caseInsensitiveCompare:)]; + returnArray = [NSArray arrayWithArray:array]; + [array release]; + return returnArray; +} + +- (NSArray *)albums +{ + NSAppleEventDescriptor *rawr = ITSendAEWithString(@"'----':obj { form:'prop', want:type('prop'), seld:type('pAlb'), from:obj { form:'indx', want:type('cTrk'), seld:abso($616C6C20$), from:obj { form:'indx', want:type('cPly'), seld:long(1), from:obj { form:'indx', want:type('cSrc'), seld:long(1), from:() } } } }", 'core', 'getd', &savedPSN); + int i; + NSMutableArray *array = [[NSMutableArray alloc] init]; + NSArray *returnArray; + for (i = 1; i <= [rawr numberOfItems]; i++) { + NSString *album = [[rawr descriptorAtIndex:i] stringValue]; + if (album && [album length] && ![array containsObject:album]) { + [array addObject:album]; + } + } + [array sortUsingSelector:@selector(caseInsensitiveCompare:)]; + returnArray = [NSArray arrayWithArray:array]; + [array release]; + return returnArray; +} + - (int)numberOfSongsInPlaylistAtIndex:(int)index { int temp1;