summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars-Dominik Braun <PromyLOPh@gmail.com>2008-07-03 16:03:02 +0200
committerLars-Dominik Braun <PromyLOPh@gmail.com>2008-07-03 16:03:02 +0200
commit66ad24c2a61a79815e738244a16cc0f7edd6f35e (patch)
tree2130bb3cf967da9513b31829d8c0577e3a4b3115
parent40980e2fcc19d8647778cb868139c0da8a85e6a9 (diff)
downloadpianobar-windows-66ad24c2a61a79815e738244a16cc0f7edd6f35e.tar.gz
pianobar-windows-66ad24c2a61a79815e738244a16cc0f7edd6f35e.tar.bz2
pianobar-windows-66ad24c2a61a79815e738244a16cc0f7edd6f35e.zip
piano: Shared station support for CreateStation
-rw-r--r--libpiano/src/main.c16
-rw-r--r--libpiano/src/piano.h3
-rw-r--r--src/main.c3
3 files changed, 13 insertions, 9 deletions
diff --git a/libpiano/src/main.c b/libpiano/src/main.c
index 4e72629..904dd65 100644
--- a/libpiano/src/main.c
+++ b/libpiano/src/main.c
@@ -498,10 +498,12 @@ PianoReturn_t PianoSearchMusic (PianoHandle_t *ph, char *searchStr,
/* create new station on server
* @public yes
* @param piano handle
- * @param music id from artist or track, you may obtain one by calling
- * PianoSearchMusic
+ * @param type: "mi" for music id (from music search) or "sh" for
+ * shared station
+ * @param id
*/
-PianoReturn_t PianoCreateStation (PianoHandle_t *ph, char *musicId) {
+PianoReturn_t PianoCreateStation (PianoHandle_t *ph, char *type,
+ char *id) {
char xmlSendBuf[10000], url[PIANO_URL_BUFFER_SIZE];
char *requestStr, *retStr;
PianoReturn_t ret;
@@ -510,14 +512,14 @@ PianoReturn_t PianoCreateStation (PianoHandle_t *ph, char *musicId) {
"<methodCall><methodName>station.createStation</methodName>"
"<params><param><value><int>%li</int></value></param>"
"<param><value><string>%s</string></value></param>"
- "<param><value><string>mi%s</string></value></param>"
+ "<param><value><string>%s%s</string></value></param>"
"</params></methodCall>", time (NULL), ph->user.authToken,
- musicId);
+ type, id);
requestStr = PianoEncryptString (xmlSendBuf);
snprintf (url, sizeof (url), PIANO_RPC_URL "rid=%s&lid=%s"
- "&method=createStation&arg1=mi%s", ph->routeId,
- ph->user.listenerId, musicId);
+ "&method=createStation&arg1=%s%s", ph->routeId,
+ ph->user.listenerId, type, id);
PianoHttpPost (ph->curlHandle, url, requestStr, &retStr);
ret = PianoXmlParseCreateStation (ph, retStr);
diff --git a/libpiano/src/piano.h b/libpiano/src/piano.h
index 7ee69fa..2e67424 100644
--- a/libpiano/src/piano.h
+++ b/libpiano/src/piano.h
@@ -164,7 +164,8 @@ PianoReturn_t PianoRenameStation (PianoHandle_t *ph, PianoStation_t *station,
PianoReturn_t PianoDeleteStation (PianoHandle_t *ph, PianoStation_t *station);
PianoReturn_t PianoSearchMusic (PianoHandle_t *ph, char *searchStr,
PianoSearchResult_t *searchResult);
-PianoReturn_t PianoCreateStation (PianoHandle_t *ph, char *musicId);
+PianoReturn_t PianoCreateStation (PianoHandle_t *ph, char *type,
+ char *id);
PianoReturn_t PianoStationAddMusic (PianoHandle_t *ph,
PianoStation_t *station, char *musicId);
PianoReturn_t PianoSongTired (PianoHandle_t *ph, PianoSong_t *song);
diff --git a/src/main.c b/src/main.c
index 2cfc9a6..869092c 100644
--- a/src/main.c
+++ b/src/main.c
@@ -426,7 +426,8 @@ int main (int argc, char **argv) {
musicId = BarUiSelectMusicId (&ph);
if (musicId != NULL) {
BarUiMsg ("Creating station... ");
- if (PianoCreateStation (&ph, musicId) == PIANO_RET_OK) {
+ if (PianoCreateStation (&ph, "mi", musicId) ==
+ PIANO_RET_OK) {
BarUiMsg ("Ok.\n");
} else {
BarUiMsg ("Error.\n");