From 349bb987049eac94867c6a556449b57ca4674546 Mon Sep 17 00:00:00 2001 From: Lars-Dominik Braun Date: Thu, 22 Sep 2011 12:22:14 +0200 Subject: piano: Protocol version bump (v32) Keys stay the same. Quickmix and seed suggestion API calls changed. Listener id is not part of the url any more. Bookmark API calls seem to be deprecated. --- src/libpiano/piano.c | 94 +++++++++++++++++++++++++--------------------------- src/libpiano/piano.h | 2 +- src/libpiano/xml.c | 2 -- 3 files changed, 47 insertions(+), 51 deletions(-) (limited to 'src/libpiano') diff --git a/src/libpiano/piano.c b/src/libpiano/piano.c index addb988..d6071f2 100644 --- a/src/libpiano/piano.c +++ b/src/libpiano/piano.c @@ -42,7 +42,7 @@ THE SOFTWARE. #include "crypt.h" #include "config.h" -#define PIANO_PROTOCOL_VERSION "31" +#define PIANO_PROTOCOL_VERSION "32" #define PIANO_RPC_HOST "www.pandora.com" #define PIANO_RPC_PORT "80" #define PIANO_RPC_PATH "/radio/xmlrpc/v" PIANO_PROTOCOL_VERSION "?" @@ -163,7 +163,6 @@ void PianoDestroyGenres (PianoGenre_t *genres) { void PianoDestroyUserInfo (PianoUserInfo_t *user) { free (user->webAuthToken); free (user->authToken); - free (user->listenerId); } /* frees the whole piano handle structure @@ -281,8 +280,6 @@ PianoReturn_t PianoRequest (PianoHandle_t *ph, PianoRequest_t *req, case PIANO_REQUEST_GET_STATIONS: /* get stations, user must be authenticated */ - assert (ph->user.listenerId != NULL); - snprintf (xmlSendBuf, sizeof (xmlSendBuf), "" "station.getStations" "%lu" @@ -290,8 +287,7 @@ PianoReturn_t PianoRequest (PianoHandle_t *ph, PianoRequest_t *req, "", (unsigned long) timestamp, ph->user.authToken); snprintf (req->urlPath, sizeof (req->urlPath), PIANO_RPC_PATH - "rid=%s&lid=%s&method=getStations", ph->routeId, - ph->user.listenerId); + "rid=%s&method=getStations", ph->routeId); break; case PIANO_REQUEST_GET_PLAYLIST: { @@ -326,10 +322,10 @@ PianoReturn_t PianoRequest (PianoHandle_t *ph, PianoRequest_t *req, ph->user.authToken, reqData->station->id, PianoAudioFormatToString (reqData->format)); snprintf (req->urlPath, sizeof (req->urlPath), PIANO_RPC_PATH - "rid=%s&lid=%s&method=getFragment&arg1=%s&arg2=0" + "rid=%s&method=getFragment&arg1=%s&arg2=0" "&arg3=&arg4=&arg5=%s&arg6=0&arg7=0", ph->routeId, - ph->user.listenerId, reqData->station->id, - PianoAudioFormatToString (reqData->format)); + reqData->station->id, PianoAudioFormatToString + (reqData->format)); break; } @@ -368,9 +364,9 @@ PianoReturn_t PianoRequest (PianoHandle_t *ph, PianoRequest_t *req, (reqData->rating == PIANO_RATE_LOVE) ? 1 : 0, reqData->songType); snprintf (req->urlPath, sizeof (req->urlPath), PIANO_RPC_PATH - "rid=%s&lid=%s&method=addFeedback&arg1=%s&arg2=%s" + "rid=%s&method=addFeedback&arg1=%s&arg2=%s" "&arg3=%s&arg4=%u&arg5=%s&arg6=false&arg7=%u", - ph->routeId, ph->user.listenerId, reqData->stationId, + ph->routeId, reqData->stationId, reqData->musicId, (reqData->userSeed == NULL) ? "" : reqData->userSeed, reqData->testStrategy, @@ -406,9 +402,8 @@ PianoReturn_t PianoRequest (PianoHandle_t *ph, PianoRequest_t *req, ph->user.authToken, reqData->station->id, xmlencodedNewName); snprintf (req->urlPath, sizeof (req->urlPath), PIANO_RPC_PATH - "rid=%s&lid=%s&method=setStationName&arg1=%s&arg2=%s", - ph->routeId, ph->user.listenerId, reqData->station->id, - urlencodedNewName); + "rid=%s&method=setStationName&arg1=%s&arg2=%s", + ph->routeId, reqData->station->id, urlencodedNewName); free (urlencodedNewName); free (xmlencodedNewName); @@ -431,8 +426,8 @@ PianoReturn_t PianoRequest (PianoHandle_t *ph, PianoRequest_t *req, "", (unsigned long) timestamp, ph->user.authToken, station->id); snprintf (req->urlPath, sizeof (req->urlPath), PIANO_RPC_PATH - "rid=%s&lid=%s&method=removeStation&arg1=%s", ph->routeId, - ph->user.listenerId, station->id); + "rid=%s&method=removeStation&arg1=%s", ph->routeId, + station->id); break; } @@ -459,8 +454,8 @@ PianoReturn_t PianoRequest (PianoHandle_t *ph, PianoRequest_t *req, "", (unsigned long) timestamp, ph->user.authToken, xmlencodedSearchStr); snprintf (req->urlPath, sizeof (req->urlPath), PIANO_RPC_PATH - "rid=%s&lid=%s&method=search&arg1=%s", ph->routeId, - ph->user.listenerId, urlencodedSearchStr); + "rid=%s&method=search&arg1=%s", ph->routeId, + urlencodedSearchStr); free (urlencodedSearchStr); free (xmlencodedSearchStr); @@ -489,8 +484,8 @@ PianoReturn_t PianoRequest (PianoHandle_t *ph, PianoRequest_t *req, ph->user.authToken, reqData->type, reqData->id); snprintf (req->urlPath, sizeof (req->urlPath), PIANO_RPC_PATH - "rid=%s&lid=%s&method=createStation&arg1=%s%s&arg2=", ph->routeId, - ph->user.listenerId, reqData->type, reqData->id); + "rid=%s&method=createStation&arg1=%s%s&arg2=", ph->routeId, + reqData->type, reqData->id); break; } @@ -514,8 +509,8 @@ PianoReturn_t PianoRequest (PianoHandle_t *ph, PianoRequest_t *req, "", (unsigned long) timestamp, ph->user.authToken, reqData->station->id, reqData->musicId); snprintf (req->urlPath, sizeof (req->urlPath), PIANO_RPC_PATH - "rid=%s&lid=%s&method=addSeed&arg1=%s&arg2=%s", ph->routeId, - ph->user.listenerId, reqData->station->id, reqData->musicId); + "rid=%s&method=addSeed&arg1=%s&arg2=%s", ph->routeId, + reqData->station->id, reqData->musicId); break; } @@ -541,8 +536,8 @@ PianoReturn_t PianoRequest (PianoHandle_t *ph, PianoRequest_t *req, (song->userSeed == NULL) ? "" : song->userSeed, song->stationId); snprintf (req->urlPath, sizeof (req->urlPath), PIANO_RPC_PATH - "rid=%s&lid=%s&method=addTiredSong&arg1=%s&arg2=%s&arg3=%s", - ph->routeId, ph->user.listenerId, + "rid=%s&method=addTiredSong&arg1=%s&arg2=%s&arg3=%s", + ph->routeId, (song->musicId == NULL) ? "" : song->musicId, (song->userSeed == NULL) ? "" : song->userSeed, song->stationId); @@ -587,16 +582,16 @@ PianoReturn_t PianoRequest (PianoHandle_t *ph, PianoRequest_t *req, } strncat (xmlSendBuf, "" - /* content type */ - "CUSTOM" - /* genre */ + /* empty */ + "" + /* empty */ "" "", sizeof (xmlSendBuf) - strlen (xmlSendBuf) - 1); snprintf (req->urlPath, sizeof (req->urlPath), PIANO_RPC_PATH - "rid=%s&lid=%s&method=setQuickMix&arg1=RANDOM&arg2=%s&arg3=CUSTOM&arg4=", - ph->routeId, ph->user.listenerId, urlArgBuf); + "rid=%s&method=setQuickMix&arg1=RANDOM&arg2=%s&arg3=&arg4=", + ph->routeId, urlArgBuf); break; } @@ -623,8 +618,8 @@ PianoReturn_t PianoRequest (PianoHandle_t *ph, PianoRequest_t *req, "", (unsigned long) timestamp, ph->user.authToken, station->id); snprintf (req->urlPath, sizeof (req->urlPath), PIANO_RPC_PATH - "rid=%s&lid=%s&method=transformShared&arg1=%s", ph->routeId, - ph->user.listenerId, station->id); + "rid=%s&method=transformShared&arg1=%s", ph->routeId, + station->id); break; } @@ -648,8 +643,8 @@ PianoReturn_t PianoRequest (PianoHandle_t *ph, PianoRequest_t *req, ph->user.authToken, reqData->song->stationId, reqData->song->musicId); snprintf (req->urlPath, sizeof (req->urlPath), PIANO_RPC_PATH - "rid=%s&lid=%s&method=narrative&arg1=%s&arg2=%s", - ph->routeId, ph->user.listenerId, reqData->song->stationId, + "rid=%s&method=narrative&arg1=%s&arg2=%s", + ph->routeId, reqData->song->stationId, reqData->song->musicId); break; } @@ -667,15 +662,19 @@ PianoReturn_t PianoRequest (PianoHandle_t *ph, PianoRequest_t *req, "%lu" /* auth token */ "%s" + /* station id */ + "%s" /* seed music id */ "%s" /* max */ "%u" "", (unsigned long) timestamp, - ph->user.authToken, reqData->musicId, reqData->max); + ph->user.authToken, reqData->station->id, reqData->musicId, + reqData->max); snprintf (req->urlPath, sizeof (req->urlPath), PIANO_RPC_PATH - "rid=%s&lid=%s&method=getSeedSuggestions&arg1=%s&arg2=%u", - ph->routeId, ph->user.listenerId, reqData->musicId, reqData->max); + "rid=%s&method=getSeedSuggestions&arg1=%s&arg2=%s&arg3=%u", + ph->routeId, reqData->station->id, reqData->musicId, + reqData->max); break; } @@ -697,9 +696,8 @@ PianoReturn_t PianoRequest (PianoHandle_t *ph, PianoRequest_t *req, "", (unsigned long) timestamp, ph->user.authToken, song->stationId, song->musicId); snprintf (req->urlPath, sizeof (req->urlPath), PIANO_RPC_PATH - "rid=%s&lid=%s&method=createBookmark&arg1=%s&arg2=%s", - ph->routeId, ph->user.listenerId, song->stationId, - song->musicId); + "rid=%s&method=createBookmark&arg1=%s&arg2=%s", + ph->routeId, song->stationId, song->musicId); break; } @@ -719,8 +717,8 @@ PianoReturn_t PianoRequest (PianoHandle_t *ph, PianoRequest_t *req, "", (unsigned long) timestamp, ph->user.authToken, song->artistMusicId); snprintf (req->urlPath, sizeof (req->urlPath), PIANO_RPC_PATH - "rid=%s&lid=%s&method=createArtistBookmark&arg1=%s", - ph->routeId, ph->user.listenerId, song->artistMusicId); + "rid=%s&method=createArtistBookmark&arg1=%s", + ph->routeId, song->artistMusicId); break; } @@ -741,8 +739,8 @@ PianoReturn_t PianoRequest (PianoHandle_t *ph, PianoRequest_t *req, "", (unsigned long) timestamp, ph->user.authToken, reqData->station->id); snprintf (req->urlPath, sizeof (req->urlPath), PIANO_RPC_PATH - "rid=%s&lid=%s&method=getStation&arg1=%s", - ph->routeId, ph->user.listenerId, reqData->station->id); + "rid=%s&method=getStation&arg1=%s", + ph->routeId, reqData->station->id); break; } @@ -761,8 +759,8 @@ PianoReturn_t PianoRequest (PianoHandle_t *ph, PianoRequest_t *req, "", (unsigned long) timestamp, ph->user.authToken, song->feedbackId); snprintf (req->urlPath, sizeof (req->urlPath), PIANO_RPC_PATH - "rid=%s&lid=%s&method=deleteFeedback&arg1=%s", - ph->routeId, ph->user.listenerId, song->feedbackId); + "rid=%s&method=deleteFeedback&arg1=%s", + ph->routeId, song->feedbackId); break; } @@ -791,8 +789,8 @@ PianoReturn_t PianoRequest (PianoHandle_t *ph, PianoRequest_t *req, "", (unsigned long) timestamp, ph->user.authToken, seedId); snprintf (req->urlPath, sizeof (req->urlPath), PIANO_RPC_PATH - "rid=%s&lid=%s&method=deleteSeed&arg1=%s", - ph->routeId, ph->user.listenerId, seedId); + "rid=%s&method=deleteSeed&arg1=%s", + ph->routeId, seedId); break; } @@ -925,7 +923,7 @@ PianoReturn_t PianoResponse (PianoHandle_t *ph, PianoRequest_t *req) { case 1: /* information exists when reauthenticating, destroy to * avoid memleak */ - if (ph->user.listenerId != NULL) { + if (ph->user.authToken != NULL) { PianoDestroyUserInfo (&ph->user); } ret = PianoXmlParseUserinfo (ph, req->responseData); diff --git a/src/libpiano/piano.h b/src/libpiano/piano.h index 54eab3a..7b692c6 100644 --- a/src/libpiano/piano.h +++ b/src/libpiano/piano.h @@ -34,7 +34,6 @@ THE SOFTWARE. typedef struct PianoUserInfo { char *webAuthToken; - char *listenerId; char *authToken; } PianoUserInfo_t; @@ -217,6 +216,7 @@ typedef struct { } PianoRequestDataExplain_t; typedef struct { + PianoStation_t *station; char *musicId; unsigned short max; PianoSearchResult_t searchResult; diff --git a/src/libpiano/xml.c b/src/libpiano/xml.c index a8dd576..7f21f8d 100644 --- a/src/libpiano/xml.c +++ b/src/libpiano/xml.c @@ -216,8 +216,6 @@ static void PianoXmlParseUserinfoCb (const char *key, const ezxml_t value, user->webAuthToken = strdup (valueStr); } else if (strcmp ("authToken", key) == 0) { user->authToken = strdup (valueStr); - } else if (strcmp ("listenerId", key) == 0) { - user->listenerId = strdup (valueStr); } } -- cgit v1.2.3