summaryrefslogtreecommitdiff
path: root/src/libpiano/request.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/libpiano/request.c')
-rw-r--r--src/libpiano/request.c31
1 files changed, 26 insertions, 5 deletions
diff --git a/src/libpiano/request.c b/src/libpiano/request.c
index cb1b30a..85d6286 100644
--- a/src/libpiano/request.c
+++ b/src/libpiano/request.c
@@ -204,12 +204,33 @@ PianoReturn_t PianoRequest (PianoHandle_t *ph, PianoRequest_t *req,
case PIANO_REQUEST_CREATE_STATION: {
/* create new station from specified musicToken or station number */
- char *token = req->data;
+ PianoRequestDataCreateStation_t *reqData = req->data;
- assert (token != NULL);
-
- json_object_object_add (j, "musicToken",
- json_object_new_string (token));
+ assert (reqData != NULL);
+ assert (reqData->token != NULL);
+
+ if (reqData->type == PIANO_MUSICTYPE_INVALID) {
+ json_object_object_add (j, "musicToken",
+ json_object_new_string (reqData->token));
+ } else {
+ json_object_object_add (j, "trackToken",
+ json_object_new_string (reqData->token));
+ switch (reqData->type) {
+ case PIANO_MUSICTYPE_SONG:
+ json_object_object_add (j, "musicType",
+ json_object_new_string ("song"));
+ break;
+
+ case PIANO_MUSICTYPE_ARTIST:
+ json_object_object_add (j, "musicType",
+ json_object_new_string ("artist"));
+ break;
+
+ default:
+ assert (0);
+ break;
+ }
+ }
method = "station.createStation";
break;