From eab4c1c3d2775228cd1ab41b2b9fcc8fb352564f Mon Sep 17 00:00:00 2001 From: chme Date: Wed, 23 Apr 2014 20:44:40 +0200 Subject: [PATCH] Fix "play next" command - the queue was not circular anymore due the missing setting of pl_prev of the next song and start the shuffle-queue with ps_shuffle --- src/player.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/player.c b/src/player.c index e27920de..b19a36d5 100644 --- a/src/player.c +++ b/src/player.c @@ -3374,14 +3374,18 @@ queue_add_next(struct player_command *cmd) if (source_head) { ps_playing = cur_playing ? cur_playing : cur_streaming; - ps_tail = ps->pl_prev; - ps_tail->pl_next = ps_playing->pl_next; - ps_tail->shuffle_next = ps_playing->shuffle_next; - ps_playing->pl_next = ps; - ps_playing->shuffle_next = ps; + // Insert ps after ps_playing + ps->pl_prev->pl_next = ps_playing->pl_next; + ps_playing->pl_next->pl_prev = ps->pl_prev; ps->pl_prev = ps_playing; - ps->shuffle_prev = ps_playing; + ps_playing->pl_next = ps; + + // Insert ps_shuffle after ps_playing + ps_shuffle->shuffle_prev->shuffle_next = ps_playing->shuffle_next; + ps_playing->shuffle_next->shuffle_prev = ps_shuffle->shuffle_prev; + ps_shuffle->shuffle_prev = ps_playing; + ps_playing->shuffle_next = ps_shuffle; } else {