summaryrefslogtreecommitdiff
path: root/src/libpiano
diff options
context:
space:
mode:
Diffstat (limited to 'src/libpiano')
-rw-r--r--src/libpiano/piano.h1
-rw-r--r--src/libpiano/request.c2
-rw-r--r--src/libpiano/response.c2
3 files changed, 5 insertions, 0 deletions
diff --git a/src/libpiano/piano.h b/src/libpiano/piano.h
index d8b84ce..e97649e 100644
--- a/src/libpiano/piano.h
+++ b/src/libpiano/piano.h
@@ -95,6 +95,7 @@ typedef struct PianoSong {
char *detailUrl;
char *trackToken;
float fileGain;
+ unsigned int length; /* song length in seconds */
PianoSongRating_t rating;
PianoAudioFormat_t audioFormat;
} PianoSong_t;
diff --git a/src/libpiano/request.c b/src/libpiano/request.c
index 82bf350..6d0c8e5 100644
--- a/src/libpiano/request.c
+++ b/src/libpiano/request.c
@@ -133,6 +133,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, "includeTrackLength",
+ json_object_new_boolean (true));
method = "station.getPlaylist";
break;
diff --git a/src/libpiano/response.c b/src/libpiano/response.c
index 53d22c1..fefa610 100644
--- a/src/libpiano/response.c
+++ b/src/libpiano/response.c
@@ -278,6 +278,8 @@ PianoReturn_t PianoResponse (PianoHandle_t *ph, PianoRequest_t *req) {
song->detailUrl = PianoJsonStrdup (s, "songDetailUrl");
song->fileGain = json_object_get_double (
json_object_object_get (s, "trackGain"));
+ song->length = json_object_get_int (
+ json_object_object_get (s, "trackLength"));
switch (json_object_get_int (json_object_object_get (s,
"songRating"))) {
case 1: