From 6f4f7c5b16c7b0cb243a41f804025bca54232903 Mon Sep 17 00:00:00 2001 From: chme Date: Sat, 16 Dec 2017 09:15:48 +0100 Subject: [PATCH] [mpd] command 'currentsong': report current item if player is stopped --- src/mpd.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/mpd.c b/src/mpd.c index af525fb1..7457743c 100644 --- a/src/mpd.c +++ b/src/mpd.c @@ -608,16 +608,13 @@ mpd_command_currentsong(struct evbuffer *evbuf, int argc, char **argv, char **er player_get_status(&status); if (status.status == PLAY_STOPPED) - { - // Return empty evbuffer if there is no current playing song - return 0; - } + queue_item = db_queue_fetch_bypos(0, status.shuffle); + else + queue_item = db_queue_fetch_byitemid(status.item_id); - queue_item = db_queue_fetch_byitemid(status.item_id); if (!queue_item) { - *errmsg = safe_asprintf("Error adding queue item info for file with id: %d", status.item_id); - return ACK_ERROR_UNKNOWN; + return 0; } ret = mpd_add_db_queue_item(evbuf, queue_item);