From e22869ebdd98ecc3f870cb1d6c5c31fd1b5d61ee Mon Sep 17 00:00:00 2001 From: Lars-Dominik Braun Date: Sat, 14 Jun 2008 16:08:35 +0200 Subject: Finally implemented "create station" This may be a bit buggy, because no return values are checked or returned. A big cleanup session is waiting... --- libpiano/main.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) (limited to 'libpiano/main.c') diff --git a/libpiano/main.c b/libpiano/main.c index cc4e65a..9754e73 100644 --- a/libpiano/main.c +++ b/libpiano/main.c @@ -456,3 +456,36 @@ void PianoSearchMusic (PianoHandle_t *ph, char *searchStr, free (retStr); free (requestStr); } + +/* create new station on server + * @author PromyLOPh + * @added 2008-06-14 + * @public yes + * @param piano handle + * @param music id from artist or track, you may obtain one by calling + * PianoSearchMusic + * @return nothing, yet + */ +void PianoCreateStation (PianoHandle_t *ph, char *musicId) { + char xmlSendBuf[10000], url[PIANO_URL_BUFFER_SIZE]; + char *requestStr, *retStr; + + snprintf (xmlSendBuf, sizeof (xmlSendBuf), "" + "station.createStation" + "%li" + "%s" + "mi%s" + "", time (NULL), ph->user.authToken, + musicId); + 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); + + PianoHttpPost (ph->curlHandle, url, requestStr, &retStr); + PianoXmlParseCreateStation (ph, retStr); + + free (requestStr); + free (retStr); +} -- cgit v1.2.3