From abc689a7e1d471a57d5f2c11ff88223f4a821a99 Mon Sep 17 00:00:00 2001 From: chme Date: Sun, 1 Nov 2015 11:46:54 +0100 Subject: [PATCH 1/3] [mpd] fix sort in queue after adding songs with findadd and searchadd commands Always add songs sorted by artist, album, disc, track. Adding by title is almost never the expected order of songs. --- src/mpd.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/mpd.c b/src/mpd.c index cc52921e..d0ae4e6c 100644 --- a/src/mpd.c +++ b/src/mpd.c @@ -1517,7 +1517,7 @@ mpd_queueitem_make(char *path, int recursive) qp.type = Q_ITEMS; qp.idx_type = I_NONE; - qp.sort = S_ALBUM; + qp.sort = S_ARTIST; if (recursive) { @@ -2499,7 +2499,7 @@ mpd_command_findadd(struct evbuffer *evbuf, int argc, char **argv, char **errmsg memset(&qp, 0, sizeof(struct query_params)); qp.type = Q_ITEMS; - qp.sort = S_NAME; + qp.sort = S_ARTIST; qp.idx_type = I_NONE; mpd_get_query_params_find(argc - 1, argv + 1, &qp); @@ -2973,7 +2973,7 @@ mpd_command_searchadd(struct evbuffer *evbuf, int argc, char **argv, char **errm memset(&qp, 0, sizeof(struct query_params)); qp.type = Q_ITEMS; - qp.sort = S_NAME; + qp.sort = S_ARTIST; qp.idx_type = I_NONE; mpd_get_query_params_search(argc - 1, argv + 1, &qp); From 7b5c80acf48d20d9040d5f17262b45175d19c5ee Mon Sep 17 00:00:00 2001 From: chme Date: Sun, 1 Nov 2015 11:59:39 +0100 Subject: [PATCH 2/3] [queue] If the playing item is not in the queue anymore, the next item should be the first item in the queue This solves the problem that after clearing the queue and adding new items while playing, aborts playback when skipped to the next item. --- src/queue.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/queue.c b/src/queue.c index c3cbef62..86e07c53 100644 --- a/src/queue.c +++ b/src/queue.c @@ -460,8 +460,8 @@ queue_next(struct queue *queue, unsigned int item_id, char shuffle, enum repeat_ item = queueitem_get_byitemid(queue, item_id); if (!item) - // Item not found - return NULL; + // Item not found, start playing from the start of the queue + item = queue->head; if (r_mode == REPEAT_SONG && item != queue->head) return item; From 350944cddde1aac68b108f20e4e2c106aef69fff Mon Sep 17 00:00:00 2001 From: chme Date: Sun, 1 Nov 2015 12:03:25 +0100 Subject: [PATCH 3/3] [mpd] fix seekid command Seeking with the seekid command for the currently playing item got broken after introducing the item-id (comparison of item-id passed from client to db-id) --- src/mpd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mpd.c b/src/mpd.c index d0ae4e6c..8d1d249b 100644 --- a/src/mpd.c +++ b/src/mpd.c @@ -1407,7 +1407,7 @@ mpd_command_seekid(struct evbuffer *evbuf, int argc, char **argv, char **errmsg) //TODO Allow seeking in songs not currently playing player_get_status(&status); - if (status.id != id) + if (status.item_id != id) { ret = asprintf(errmsg, "Given song is not the current playing one, seeking is not supported"); if (ret < 0)