diff options
author | Lars-Dominik Braun <lars@6xq.net> | 2012-05-02 17:21:46 +0200 |
---|---|---|
committer | Lars-Dominik Braun <lars@6xq.net> | 2012-05-02 17:21:46 +0200 |
commit | 951d6206f2837d5985899c5b974690e0076b68c5 (patch) | |
tree | 94f1371346a6d0d0df2b5372569e8d4c4f41b008 /src/libpiano/request.c | |
parent | 524289828bffe46f465dbd574d5f30e3c1ee2f62 (diff) | |
download | pianobar-951d6206f2837d5985899c5b974690e0076b68c5.tar.gz pianobar-951d6206f2837d5985899c5b974690e0076b68c5.tar.bz2 pianobar-951d6206f2837d5985899c5b974690e0076b68c5.zip |
piano: Audio format support
Ask Pandora for audio format requested by user. Closes #244.
Diffstat (limited to 'src/libpiano/request.c')
-rw-r--r-- | src/libpiano/request.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/libpiano/request.c b/src/libpiano/request.c index 3a1d7fb..fcc13d4 100644 --- a/src/libpiano/request.c +++ b/src/libpiano/request.c @@ -36,6 +36,30 @@ THE SOFTWARE. #include "piano.h" #include "crypt.h" +/* convert audio format id to string + * @param format id + * @return constant string + */ +static const char *PianoAudioFormatToString (PianoAudioFormat_t format) { + switch (format) { + case PIANO_AF_AACPLUS: + return "HTTP_64_AACPLUS"; + break; + + case PIANO_AF_MP3: + return "HTTP_128_MP3"; + break; + + case PIANO_AF_MP3_HI: + return "HTTP_192_MP3"; + break; + + default: + return NULL; + break; + } +} + /* prepare piano request (initializes request type, urlpath and postData) * @param piano handle * @param request structure @@ -133,6 +157,8 @@ PianoReturn_t PianoRequest (PianoHandle_t *ph, PianoRequest_t *req, json_object_object_add (j, "stationToken", json_object_new_string (reqData->station->id)); + json_object_object_add (j, "additionalAudioUrl", + json_object_new_string (PianoAudioFormatToString (reqData->format))); method = "station.getPlaylist"; break; |