From: Joseph Spiros Date: Sat, 15 Mar 2003 17:33:48 +0000 (+0000) Subject: Quick Remote API update for an enumeration of all supported playlist classes. X-Git-Tag: v1.0~184 X-Git-Url: http://git.ithinksw.org/MenuTunes.git/commitdiff_plain/efd57bc799aac892be3c161826168729b0419fb4 Quick Remote API update for an enumeration of all supported playlist classes. --- diff --git a/ITMTRemote.h b/ITMTRemote.h index b65b2d1..137b859 100755 --- a/ITMTRemote.h +++ b/ITMTRemote.h @@ -53,6 +53,22 @@ typedef enum { ITMTRemotePlayerForwarding } ITMTRemotePlayerPlayingState; +/*! + * @enum ITMTRemotePlayerPlaylistClass + * @abstract Possible playlist classes used by a remote's player + * @discussion Used in functions that report the class of a playlist to MenuTunes. While we borrow the terms/descriptions from iTunes, these should work fine with any other player. If your player doesn't support a given type of playlist, then just return ITMTRemotePlayerPlaylist. + * @constant ITMTRemotePlayerLibraryPlaylist For players that have one playlist that contains all of a user's music, or for players that don't have the concept of multiple playlists, this is the class for that "Master" list. + * @constant ITMTRemotePlayerPlaylist The generic playlist. Created and maintained by the user. + * @constant ITMTRemotePlayerSmartPlaylist A smart playlist is a playlist who's contents are dynamic, based on a set of criteria or updated by a script. These are usually not edited directly by the user, but instead maintained by the player. + * @constant ITMTRemotePlayerRadioPlaylist This is for when playing tracks off of (online) radio stations. + */ +typedef enum { + ITMTRemotePlayerLibraryPlaylist = -1, + ITMTRemotePlayerPlaylist, + ITMTRemotePlayerSmartPlaylist, + ITMTRemotePlayerRadioPlaylist +} ITMTRemotePlayerPlaylistClass; + /*! * @enum ITMTRemotePlayerRepeatMode * @abstract Possible repeat modes for the remote's player. @@ -176,7 +192,7 @@ typedef enum { /*! * @method classOfPlaylistAtIndex: */ -- (NSString *)classOfPlaylistAtIndex:(int)index; +- (ITMTRemotePlayerPlaylistClass)classOfPlaylistAtIndex:(int)index; /*! * @method currentPlaylistIndex diff --git a/ITMTRemote.m b/ITMTRemote.m index 8092d3e..8753f6d 100755 --- a/ITMTRemote.m +++ b/ITMTRemote.m @@ -79,7 +79,7 @@ return nil; } -- (NSString *)classOfPlaylistAtIndex:(int)index +- (ITMTRemotePlayerPlaylistClass)classOfPlaylistAtIndex:(int)index { return nil; } diff --git a/iTunesRemote.m b/iTunesRemote.m index 35256b4..b14f74e 100755 --- a/iTunesRemote.m +++ b/iTunesRemote.m @@ -125,17 +125,19 @@ 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 +- (ITMTRemotePlayerPlaylistClass)classOfPlaylistAtIndex:(int)index { int realResult = [[ITAppleEventCenter sharedCenter] sendTwoTierAEWithRequestedKeyForNumber:@"pcls" fromObjectByKey:@"pPla" eventClass:@"core" eventID:@"getd" appPSN:iTunesPSN]; + // ADD SUPPORT FOR RETURNING A ITMTRemotePlayerLibraryPlaylist WHEN PLAYLIST IS LIBRARY. + switch (realResult) { case 'cRTP': - return @"radio tuner playlist"; + return ITMTRemotePlayerRadioPlaylist; break; default: - return @"playlist"; + return ITMTRemotePlayerPlaylist; } }