summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libpiano/src/piano.c37
-rw-r--r--libpiano/src/piano.h12
-rw-r--r--libpiano/src/xml.c10
-rw-r--r--src/ui_act.c10
4 files changed, 37 insertions, 32 deletions
diff --git a/libpiano/src/piano.c b/libpiano/src/piano.c
index 8682cda..fe0393b 100644
--- a/libpiano/src/piano.c
+++ b/libpiano/src/piano.c
@@ -135,8 +135,6 @@ void PianoDestroyPlaylist (PianoSong_t *playlist) {
while (curSong != NULL) {
PianoFree (curSong->audioUrl, 0);
PianoFree (curSong->artist, 0);
- PianoFree (curSong->focusTraitId, 0);
- PianoFree (curSong->matchingSeed, 0);
PianoFree (curSong->musicId, 0);
PianoFree (curSong->title, 0);
PianoFree (curSong->userSeed, 0);
@@ -312,30 +310,37 @@ PianoReturn_t PianoRequest (PianoHandle_t *ph, PianoRequest_t *req,
snprintf (xmlSendBuf, sizeof (xmlSendBuf), "<?xml version=\"1.0\"?>"
"<methodCall><methodName>station.addFeedback</methodName>"
"<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>"
+ /* music id */
"<param><value><string>%s</string></value></param>"
+ /* user seed */
"<param><value><string>%s</string></value></param>"
- "<param><value><string>%s</string></value></param>"
- "<param><value><string>%s</string></value></param>"
- "<param><value></value></param>"
+ /* test strategy */
+ "<param><value>%u</value></param>"
+ /* positive */
"<param><value><boolean>%i</boolean></value></param>"
+ /* "is-creator-quickmix" */
"<param><value><boolean>0</boolean></value></param>"
+ /* song type */
+ "<param><value><int>%u</int></value></param>"
"</params></methodCall>", (unsigned long) time (NULL),
ph->user.authToken, reqData->stationId, reqData->musicId,
- (reqData->matchingSeed == NULL) ? "" : reqData->matchingSeed,
(reqData->userSeed == NULL) ? "" : reqData->userSeed,
- (reqData->focusTraitId == NULL) ? "" : reqData->focusTraitId,
- (reqData->rating == PIANO_RATE_LOVE) ? 1 : 0);
+ reqData->testStrategy,
+ (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"
- "&arg3=%s&arg4=%s&arg5=%s&arg6=&arg7=%s&arg8=false",
+ "&arg3=%s&arg4=%u&arg5=%s&arg6=false&arg7=%u",
ph->routeId, ph->user.listenerId, reqData->stationId,
reqData->musicId,
- (reqData->matchingSeed == NULL) ? "" : reqData->matchingSeed,
(reqData->userSeed == NULL) ? "" : reqData->userSeed,
- (reqData->focusTraitId == NULL) ? "" : reqData->focusTraitId,
- (reqData->rating == PIANO_RATE_LOVE) ? "true" : "false");
+ reqData->testStrategy,
+ (reqData->rating == PIANO_RATE_LOVE) ? "true" : "false",
+ reqData->songType);
break;
}
@@ -653,10 +658,10 @@ PianoReturn_t PianoRequest (PianoHandle_t *ph, PianoRequest_t *req,
PianoRequestDataAddFeedback_t transformedReqData;
transformedReqData.stationId = reqData->song->stationId;
transformedReqData.musicId = reqData->song->musicId;
- transformedReqData.matchingSeed = reqData->song->matchingSeed;
transformedReqData.userSeed = reqData->song->userSeed;
- transformedReqData.focusTraitId = reqData->song->focusTraitId;
transformedReqData.rating = reqData->rating;
+ transformedReqData.testStrategy = reqData->song->testStrategy;
+ transformedReqData.songType = reqData->song->songType;
req->data = &transformedReqData;
/* create request data (url, post data) */
@@ -682,9 +687,9 @@ PianoReturn_t PianoRequest (PianoHandle_t *ph, PianoRequest_t *req,
assert (reqData->step < 2);
transformedReqData.musicId = reqData->song->musicId;
- transformedReqData.matchingSeed = "";
transformedReqData.userSeed = "";
- transformedReqData.focusTraitId = "";
+ transformedReqData.songType = reqData->song->songType;
+ transformedReqData.testStrategy = reqData->song->testStrategy;
req->data = &transformedReqData;
switch (reqData->step) {
diff --git a/libpiano/src/piano.h b/libpiano/src/piano.h
index 6b25b2d..aba4ebd 100644
--- a/libpiano/src/piano.h
+++ b/libpiano/src/piano.h
@@ -64,18 +64,18 @@ typedef enum {
typedef struct PianoSong {
char *artist;
char *artistMusicId;
- char *matchingSeed;
- float fileGain;
- PianoSongRating_t rating;
char *stationId;
char *album;
char *userSeed;
char *audioUrl;
char *musicId;
char *title;
- char *focusTraitId;
char *identity;
+ float fileGain;
+ PianoSongRating_t rating;
PianoAudioFormat_t audioFormat;
+ int testStrategy;
+ unsigned int songType;
struct PianoSong *next;
} PianoSong_t;
@@ -163,10 +163,10 @@ typedef struct {
typedef struct {
char *stationId;
char *musicId;
- char *matchingSeed;
char *userSeed;
- char *focusTraitId;
PianoSongRating_t rating;
+ unsigned int testStrategy;
+ unsigned int songType;
} PianoRequestDataAddFeedback_t;
typedef struct {
diff --git a/libpiano/src/xml.c b/libpiano/src/xml.c
index 78f7f21..cd06ae5 100644
--- a/libpiano/src/xml.c
+++ b/libpiano/src/xml.c
@@ -263,12 +263,8 @@ static void PianoXmlParsePlaylistCb (const char *key, const ezxml_t value,
song->artist = strdup (valueStr);
} else if (strcmp ("musicId", key) == 0) {
song->musicId = strdup (valueStr);
- } else if (strcmp ("matchingSeed", key) == 0) {
- song->matchingSeed = strdup (valueStr);
} else if (strcmp ("userSeed", key) == 0) {
song->userSeed = strdup (valueStr);
- } else if (strcmp ("focusTraitId", key) == 0) {
- song->focusTraitId = strdup (valueStr);
} else if (strcmp ("songTitle", key) == 0) {
song->title = strdup (valueStr);
} else if (strcmp ("identity", key) == 0) {
@@ -295,7 +291,11 @@ static void PianoXmlParsePlaylistCb (const char *key, const ezxml_t value,
}
} else if (strcmp ("artistMusicId", key) == 0) {
song->artistMusicId = strdup (valueStr);
- }
+ } else if (strcmp ("testStrategy", key) == 0) {
+ song->testStrategy = atoi (valueStr);
+ } else if (strcmp ("songType", key) == 0) {
+ song->songType = atoi (valueStr);
+ }
}
/* parses userinfos sent by pandora as login response
diff --git a/src/ui_act.c b/src/ui_act.c
index c81fc19..664c966 100644
--- a/src/ui_act.c
+++ b/src/ui_act.c
@@ -273,20 +273,20 @@ BarUiActCallback(BarUiActDebug) {
"audioFormat:\t%i\n"
"audioUrl:\t%s\n"
"fileGain:\t%f\n"
- "focusTraitId:\t%s\n"
"identity:\t%s\n"
- "matchingSeed:\t%s\n"
"musicId:\t%s\n"
"rating:\t%i\n"
+ "songType:\t%i\n"
"stationId:\t%s\n"
+ "testStrategy:\t%i\n"
"title:\t%s\n"
"userSeed:\t%s\n",
app->playlist->album, app->playlist->artist,
app->playlist->audioFormat, app->playlist->audioUrl,
- app->playlist->fileGain, app->playlist->focusTraitId,
- app->playlist->identity, app->playlist->matchingSeed,
+ app->playlist->fileGain, app->playlist->identity,
app->playlist->musicId, app->playlist->rating,
- app->playlist->stationId, app->playlist->title,
+ app->playlist->songType, app->playlist->stationId,
+ app->playlist->testStrategy, app->playlist->title,
app->playlist->userSeed);
}