diff options
author | Lars-Dominik Braun <lars@6xq.net> | 2011-03-21 13:19:39 +0100 |
---|---|---|
committer | Lars-Dominik Braun <lars@6xq.net> | 2011-03-21 14:54:30 +0100 |
commit | ab98a7b6ac4637301b0e2ff62970cabf2d639408 (patch) | |
tree | b2bf59df8d6770f1a0864067f0047587fe27983d | |
parent | ceed4acd2f404dede571a014c186acc985397d94 (diff) | |
download | pianobar-windows-ab98a7b6ac4637301b0e2ff62970cabf2d639408.tar.gz pianobar-windows-ab98a7b6ac4637301b0e2ff62970cabf2d639408.tar.bz2 pianobar-windows-ab98a7b6ac4637301b0e2ff62970cabf2d639408.zip |
piano: Delete seed support
-rw-r--r-- | src/libpiano/piano.c | 37 | ||||
-rw-r--r-- | src/libpiano/piano.h | 6 |
2 files changed, 43 insertions, 0 deletions
diff --git a/src/libpiano/piano.c b/src/libpiano/piano.c index 9075df7..49cbf27 100644 --- a/src/libpiano/piano.c +++ b/src/libpiano/piano.c @@ -755,6 +755,36 @@ PianoReturn_t PianoRequest (PianoHandle_t *ph, PianoRequest_t *req, break; } + case PIANO_REQUEST_DELETE_SEED: { + PianoRequestDataDeleteSeed_t *reqData = req->data; + char *seedId = NULL; + + assert (reqData != NULL); + assert (reqData->song != NULL || reqData->artist != NULL); + + if (reqData->song != NULL) { + seedId = reqData->song->seedId; + } else if (reqData->artist != NULL) { + seedId = reqData->artist->seedId; + } + + assert (seedId != NULL); + + snprintf (xmlSendBuf, sizeof (xmlSendBuf), "<?xml version=\"1.0\"?>" + "<methodCall><methodName>station.deleteSeed</methodName>" + "<params><param><value><int>%lu</int></value></param>" + /* auth token */ + "<param><value><string>%s</string></value></param>" + /* seed id */ + "<param><value><string>%s</string></value></param>" + "</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); + break; + } + /* "high-level" wrapper */ case PIANO_REQUEST_RATE_SONG: { /* love/ban song */ @@ -1089,6 +1119,13 @@ PianoReturn_t PianoResponse (PianoHandle_t *ph, PianoRequest_t *req) { &reqData->info); break; } + + case PIANO_REQUEST_DELETE_SEED: { + assert (req->responseData != NULL); + + /* dummy function, checks for errors only */ + ret = PianoXmlParseTranformStation (req->responseData); + } } return ret; diff --git a/src/libpiano/piano.h b/src/libpiano/piano.h index d013363..9ca7827 100644 --- a/src/libpiano/piano.h +++ b/src/libpiano/piano.h @@ -145,6 +145,7 @@ typedef enum { PIANO_REQUEST_BOOKMARK_ARTIST = 19, PIANO_REQUEST_GET_STATION_INFO = 20, PIANO_REQUEST_DELETE_FEEDBACK = 21, + PIANO_REQUEST_DELETE_SEED = 22, } PianoRequestType_t; typedef struct PianoRequest { @@ -225,6 +226,11 @@ typedef struct { PianoStationInfo_t info; } PianoRequestDataGetStationInfo_t; +typedef struct { + PianoSong_t *song; + PianoArtist_t *artist; +} PianoRequestDataDeleteSeed_t; + typedef enum { PIANO_RET_ERR = 0, PIANO_RET_OK = 1, |