[mpd] command 'currentsong': report current item if player is stopped

This commit is contained in:
chme 2017-12-16 09:15:48 +01:00
parent 80e0808b18
commit 6f4f7c5b16

View File

@ -608,16 +608,13 @@ mpd_command_currentsong(struct evbuffer *evbuf, int argc, char **argv, char **er
player_get_status(&status); player_get_status(&status);
if (status.status == PLAY_STOPPED) if (status.status == PLAY_STOPPED)
{ queue_item = db_queue_fetch_bypos(0, status.shuffle);
// Return empty evbuffer if there is no current playing song else
return 0;
}
queue_item = db_queue_fetch_byitemid(status.item_id); queue_item = db_queue_fetch_byitemid(status.item_id);
if (!queue_item) if (!queue_item)
{ {
*errmsg = safe_asprintf("Error adding queue item info for file with id: %d", status.item_id); return 0;
return ACK_ERROR_UNKNOWN;
} }
ret = mpd_add_db_queue_item(evbuf, queue_item); ret = mpd_add_db_queue_item(evbuf, queue_item);