summaryrefslogtreecommitdiff
path: root/src/libpiano/piano.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/libpiano/piano.c')
-rw-r--r--src/libpiano/piano.c94
1 files changed, 46 insertions, 48 deletions
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), "<?xml version=\"1.0\"?>"
"<methodCall><methodName>station.getStations</methodName>"
"<params><param><value><int>%lu</int></value></param>"
@@ -290,8 +287,7 @@ PianoReturn_t PianoRequest (PianoHandle_t *ph, PianoRequest_t *req,
"</params></methodCall>", (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,
"</params></methodCall>", (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,
"</params></methodCall>", (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,
"</params></methodCall>", (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,
"</data></array></value></param>"
- /* content type */
- "<param><value><string>CUSTOM</string></value></param>"
- /* genre */
+ /* empty */
+ "<param><value><string></string></value></param>"
+ /* empty */
"<param><value><string></string></value></param>"
"</params></methodCall>",
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,
"</params></methodCall>", (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,
"<params><param><value><int>%lu</int></value></param>"
/* auth token */
"<param><value><string>%s</string></value></param>"
+ /* station id */
+ "<param><value><string>%s</string></value></param>"
/* seed music id */
"<param><value><string>%s</string></value></param>"
/* max */
"<param><value><int>%u</int></value></param>"
"</params></methodCall>", (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,
"</params></methodCall>", (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,
"</params></methodCall>", (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,
"</params></methodCall>", (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,
"</params></methodCall>", (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,
"</params></methodCall>", (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);