From 880a0446c465d22ea3e36db838b8df1e594fa4da Mon Sep 17 00:00:00 2001 From: Lars-Dominik Braun Date: Thu, 19 Jun 2008 15:49:23 +0200 Subject: "Add more music" implemented This can add more track/artist seeds to the currently played station --- libpiano/src/main.c | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) (limited to 'libpiano/src/main.c') diff --git a/libpiano/src/main.c b/libpiano/src/main.c index 99daee1..1d5a6d0 100644 --- a/libpiano/src/main.c +++ b/libpiano/src/main.c @@ -464,3 +464,41 @@ PianoReturn_t PianoCreateStation (PianoHandle_t *ph, char *musicId) { return ret; } + +/* FIXME: update station data instead of replacing them */ +/* add more music to existing station; multithreaded apps beware! this alters + * station data, don't forget to lock the station pointer you passed to this + * function + * @public yes + * @param piano handle + * @param add music to this station + * @param music id; can be obtained with PianoSearchMusic () + */ +PianoReturn_t PianoStationAddMusic (PianoHandle_t *ph, + PianoStation_t *station, char *musicId) { + char xmlSendBuf[10000], url[PIANO_URL_BUFFER_SIZE]; + char *requestStr, *retStr; + PianoReturn_t ret; + + snprintf (xmlSendBuf, sizeof (xmlSendBuf), "" + "station.addSeed" + "%li" + "%s" + "%s" + "%s" + "", time (NULL), ph->user.authToken, + station->id, musicId); + requestStr = PianoEncryptString (xmlSendBuf); + + snprintf (url, sizeof (url), PIANO_RPC_URL "rid=%s&lid=%s" + "&method=addSeed&arg1=%s&arg2=%s", ph->routeId, + ph->user.listenerId, station->id, musicId); + + PianoHttpPost (ph->curlHandle, url, requestStr, &retStr); + ret = PianoXmlParseAddSeed (ph, retStr, station); + + free (requestStr); + free (retStr); + + return ret; +} -- cgit v1.2.3