diff options
author | Lars-Dominik Braun <PromyLOPh@gmail.com> | 2008-07-17 15:53:01 +0200 |
---|---|---|
committer | Lars-Dominik Braun <PromyLOPh@gmail.com> | 2008-07-17 15:53:01 +0200 |
commit | 7c96aa41979b1c1b0b4c582c8ac31b7ff779b737 (patch) | |
tree | 125ea492c67f2bbf0d3e2b81e935de2c2376dc5d /libpiano/src/http.c | |
parent | 6b0824285abab829cf97de770c9051a60255106e (diff) | |
download | pianobar-7c96aa41979b1c1b0b4c582c8ac31b7ff779b737.tar.gz pianobar-7c96aa41979b1c1b0b4c582c8ac31b7ff779b737.tar.bz2 pianobar-7c96aa41979b1c1b0b4c582c8ac31b7ff779b737.zip |
piano: Initial global genre stations support
Pandora provides a xml list of genre stations. Read this list and insert its
data into our PianoHandle tree if requested.
Diffstat (limited to 'libpiano/src/http.c')
-rw-r--r-- | libpiano/src/http.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/libpiano/src/http.c b/libpiano/src/http.c index c480ff8..c633816 100644 --- a/libpiano/src/http.c +++ b/libpiano/src/http.c @@ -89,3 +89,31 @@ PianoReturn_t PianoHttpPost (CURL *ch, char *url, char *postData, return ret; } + +/* get data + * @param initialized curl handle + * @param call this url + * @param put received data here, memory is allocated by this function + * @return nothing yet + */ +PianoReturn_t PianoHttpGet (CURL *ch, char *url, char **retData) { + /* Let's hope nothing will be bigger than this... */ + char curlRet[PIANO_HTTP_BUFFER_SIZE]; + PianoReturn_t ret; + + curl_easy_setopt (ch, CURLOPT_URL, url); + curl_easy_setopt (ch, CURLOPT_WRITEFUNCTION, PianoCurlRetToVar); + memset (curlRet, 0, sizeof (curlRet)); + curl_easy_setopt (ch, CURLOPT_WRITEDATA, curlRet); + + if (curl_easy_perform (ch) == CURLE_OK) { + ret = PIANO_RET_OK; + *retData = calloc (strlen (curlRet) + 1, sizeof (char)); + strcpy (*retData, curlRet); + } else { + ret = PIANO_RET_NET_ERROR; + *retData = NULL; + } + + return ret; +} |