From 41a00cc1e643d9e9a69991ead268777ecd17c154 Mon Sep 17 00:00:00 2001 From: Lars-Dominik Braun Date: Sat, 30 Sep 2017 17:06:41 +0200 Subject: Add tired rating to song Now we can show a tired icon in the history. Closes #637. --- src/libpiano/piano.h | 3 ++- src/libpiano/request.c | 3 ++- src/libpiano/response.c | 7 ++++++- 3 files changed, 10 insertions(+), 3 deletions(-) (limited to 'src/libpiano') diff --git a/src/libpiano/piano.h b/src/libpiano/piano.h index 7f31397..0ec6c49 100644 --- a/src/libpiano/piano.h +++ b/src/libpiano/piano.h @@ -65,7 +65,8 @@ typedef struct PianoStation { typedef enum { PIANO_RATE_NONE = 0, PIANO_RATE_LOVE = 1, - PIANO_RATE_BAN = 2 + PIANO_RATE_BAN = 2, + PIANO_RATE_TIRED = 3, } PianoSongRating_t; /* UNKNOWN should be 0, because memset sets audio format to 0 */ diff --git a/src/libpiano/request.c b/src/libpiano/request.c index 02b4b43..66c34d7 100644 --- a/src/libpiano/request.c +++ b/src/libpiano/request.c @@ -146,7 +146,8 @@ PianoReturn_t PianoRequest (PianoHandle_t *ph, PianoRequest_t *req, assert (reqData != NULL); assert (reqData->trackToken != NULL); assert (reqData->stationId != NULL); - assert (reqData->rating != PIANO_RATE_NONE); + assert (reqData->rating != PIANO_RATE_NONE && + reqData->rating != PIANO_RATE_TIRED); json_object_object_add (j, "stationToken", json_object_new_string (reqData->stationId)); diff --git a/src/libpiano/response.c b/src/libpiano/response.c index 0e8c783..fd342ed 100644 --- a/src/libpiano/response.c +++ b/src/libpiano/response.c @@ -436,8 +436,13 @@ PianoReturn_t PianoResponse (PianoHandle_t *ph, PianoRequest_t *req) { break; } + case PIANO_REQUEST_ADD_TIRED_SONG: { + PianoSong_t * const song = req->data; + song->rating = PIANO_RATE_TIRED; + break; + } + case PIANO_REQUEST_ADD_SEED: - case PIANO_REQUEST_ADD_TIRED_SONG: case PIANO_REQUEST_SET_QUICKMIX: case PIANO_REQUEST_BOOKMARK_SONG: case PIANO_REQUEST_BOOKMARK_ARTIST: -- cgit v1.2.3