From 6a9579be3afecaae2f62baacca10335de1371cf1 Mon Sep 17 00:00:00 2001 From: Lars-Dominik Braun Date: Fri, 7 Aug 2009 13:20:45 +0200 Subject: New feature: Seed suggestions --- libpiano/src/main.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'libpiano/src/main.c') diff --git a/libpiano/src/main.c b/libpiano/src/main.c index b3bcab8..844d757 100644 --- a/libpiano/src/main.c +++ b/libpiano/src/main.c @@ -763,6 +763,38 @@ PianoReturn_t PianoExplain (PianoHandle_t *ph, const PianoSong_t *song, return ret; } +/* Get seed suggestions by music id + * @param piano handle + * @param music id + * @param max results + * @param result buffer + */ +PianoReturn_t PianoSeedSuggestions (PianoHandle_t *ph, const char *musicId, + unsigned int max, PianoSearchResult_t *searchResult) { + char xmlSendBuf[PIANO_SEND_BUFFER_SIZE], retStr[PIANO_RECV_BUFFER]; + PianoReturn_t ret; + + snprintf (xmlSendBuf, sizeof (xmlSendBuf), "" + "music.getSeedSuggestions" + "%li" + "%s" + "%s" + "%u" + "", time (NULL), ph->user.authToken, + musicId, max); + + snprintf (ph->waith.path, sizeof (ph->waith.path), PIANO_RPC_PATH + "rid=%s&lid=%s&method=method=getSeedSuggestions&arg1=%s&arg2=%u", + ph->routeId, ph->user.listenerId, musicId, max); + + if ((ret = PianoHttpPost (&ph->waith, xmlSendBuf, retStr, + sizeof (retStr))) == PIANO_RET_OK) { + ret = PianoXmlParseSeedSuggestions (retStr, searchResult); + } + + return ret; +} + /* convert return value to human-readable string * @param enum * @return error string -- cgit v1.2.3