From 8cf92b107695b2fe04b86c90d64f4f74e4288c44 Mon Sep 17 00:00:00 2001 From: Lars-Dominik Braun Date: Sat, 6 Nov 2010 13:32:31 +0100 Subject: Protocol version bump (v29) - New crypto keys (thanks to ZigZagJoe for extracting them) - addTiredSong api changed - song identity not needed any more => removed from libpiano --- libpiano/src/piano.c | 52 ++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 46 insertions(+), 6 deletions(-) (limited to 'libpiano/src/piano.c') diff --git a/libpiano/src/piano.c b/libpiano/src/piano.c index 1c61e15..52b72c4 100644 --- a/libpiano/src/piano.c +++ b/libpiano/src/piano.c @@ -39,7 +39,7 @@ THE SOFTWARE. #include "crypt.h" #include "config.h" -#define PIANO_PROTOCOL_VERSION "28" +#define PIANO_PROTOCOL_VERSION "29" #define PIANO_RPC_HOST "www.pandora.com" #define PIANO_RPC_PORT "80" #define PIANO_RPC_PATH "/radio/xmlrpc/v" PIANO_PROTOCOL_VERSION "?" @@ -124,7 +124,6 @@ void PianoDestroyPlaylist (PianoSong_t *playlist) { free (curSong->musicId); free (curSong->title); free (curSong->userSeed); - free (curSong->identity); free (curSong->stationId); free (curSong->album); free (curSong->artistMusicId); @@ -282,17 +281,24 @@ PianoReturn_t PianoRequest (PianoHandle_t *ph, PianoRequest_t *req, assert (reqData->station->id != NULL); assert (reqData->format != PIANO_AF_UNKNOWN); - /* FIXME: remove static, "magic" numbers */ snprintf (xmlSendBuf, sizeof (xmlSendBuf), "" "playlist.getFragment" "%lu" + /* auth token */ "%s" + /* station id */ "%s" + /* total listening time */ "0" + /* time since last session */ "" + /* tracking code */ "" + /* audio format */ "%s" + /* delta listening time */ "0" + /* listening timestamp */ "0" "", (unsigned long) timestamp, ph->user.authToken, reqData->station->id, @@ -368,8 +374,11 @@ PianoReturn_t PianoRequest (PianoHandle_t *ph, PianoRequest_t *req, snprintf (xmlSendBuf, sizeof (xmlSendBuf), "" "station.setStationName" "%lu" + /* auth token */ "%s" + /* station id */ "%s" + /* new name */ "%s" "", (unsigned long) timestamp, ph->user.authToken, reqData->station->id, @@ -393,7 +402,9 @@ PianoReturn_t PianoRequest (PianoHandle_t *ph, PianoRequest_t *req, snprintf (xmlSendBuf, sizeof (xmlSendBuf), "" "station.removeStation" "%lu" + /* auth token */ "%s" + /* station id */ "%s" "", (unsigned long) timestamp, ph->user.authToken, station->id); @@ -419,7 +430,9 @@ PianoReturn_t PianoRequest (PianoHandle_t *ph, PianoRequest_t *req, snprintf (xmlSendBuf, sizeof (xmlSendBuf), "" "music.search" "%lu" + /* auth token */ "%s" + /* search string */ "%s" "", (unsigned long) timestamp, ph->user.authToken, xmlencodedSearchStr); @@ -487,12 +500,23 @@ PianoReturn_t PianoRequest (PianoHandle_t *ph, PianoRequest_t *req, "listener.addTiredSong" "%lu" "%s" + /* key */ + "%s" + /* user seed */ + "%s" + /* station id */ "%s" "", (unsigned long) timestamp, - ph->user.authToken, song->identity); + ph->user.authToken, + (song->musicId == NULL) ? "" : song->musicId, + (song->userSeed == NULL) ? "" : song->userSeed, + song->stationId); snprintf (req->urlPath, sizeof (req->urlPath), PIANO_RPC_PATH - "rid=%s&lid=%s&method=addTiredSong&arg1=%s", ph->routeId, - ph->user.listenerId, song->identity); + "rid=%s&lid=%s&method=addTiredSong&arg1=%s&arg2=%s&arg3=%s", + ph->routeId, ph->user.listenerId, + (song->musicId == NULL) ? "" : song->musicId, + (song->userSeed == NULL) ? "" : song->userSeed, + song->stationId); break; } @@ -507,6 +531,7 @@ PianoReturn_t PianoRequest (PianoHandle_t *ph, PianoRequest_t *req, "station.setQuickMix" "%lu" "%s" + /* quick mix type */ "RANDOM" "", (unsigned long) timestamp, ph->user.authToken); @@ -533,7 +558,9 @@ PianoReturn_t PianoRequest (PianoHandle_t *ph, PianoRequest_t *req, } strncat (xmlSendBuf, "" + /* content type */ "CUSTOM" + /* genre */ "" "", sizeof (xmlSendBuf) - strlen (xmlSendBuf) - 1); @@ -560,7 +587,9 @@ PianoReturn_t PianoRequest (PianoHandle_t *ph, PianoRequest_t *req, snprintf (xmlSendBuf, sizeof (xmlSendBuf), "" "station.transformShared" "%lu" + /* auth token */ "%s" + /* station id */ "%s" "", (unsigned long) timestamp, ph->user.authToken, station->id); @@ -580,8 +609,11 @@ PianoReturn_t PianoRequest (PianoHandle_t *ph, PianoRequest_t *req, snprintf (xmlSendBuf, sizeof (xmlSendBuf), "" "playlist.narrative" "%lu" + /* auth token */ "%s" + /* station id */ "%s" + /* music id */ "%s" "", (unsigned long) timestamp, ph->user.authToken, reqData->song->stationId, @@ -604,8 +636,11 @@ PianoReturn_t PianoRequest (PianoHandle_t *ph, PianoRequest_t *req, snprintf (xmlSendBuf, sizeof (xmlSendBuf), "" "music.getSeedSuggestions" "%lu" + /* auth token */ "%s" + /* seed music id */ "%s" + /* max */ "%u" "", (unsigned long) timestamp, ph->user.authToken, reqData->musicId, reqData->max); @@ -624,8 +659,11 @@ PianoReturn_t PianoRequest (PianoHandle_t *ph, PianoRequest_t *req, snprintf (xmlSendBuf, sizeof (xmlSendBuf), "" "station.createBookmark" "%lu" + /* auth token */ "%s" + /* station id */ "%s" + /* music id */ "%s" "", (unsigned long) timestamp, ph->user.authToken, song->stationId, song->musicId); @@ -645,7 +683,9 @@ PianoReturn_t PianoRequest (PianoHandle_t *ph, PianoRequest_t *req, snprintf (xmlSendBuf, sizeof (xmlSendBuf), "" "station.createArtistBookmark" "%lu" + /* auth token */ "%s" + /* music id */ "%s" "", (unsigned long) timestamp, ph->user.authToken, song->artistMusicId); -- cgit v1.2.3