Commit 58a5d308 authored by Max Kellermann's avatar Max Kellermann

playlist: don't preserve "current" song after "random" toggle

When MPD is not playing, it may still remember which is the "current" song. When you switch to "random" mode, MPD will always start playing exactly this song. This defies the goal of "random" mode a little. Clear the "current" song when MPD is not playing during the "random" mode switch.
parent 9d447dda
......@@ -300,7 +300,8 @@ void setPlaylistRandomStatus(struct playlist *playlist, bool status)
/* shuffle the queue order, but preserve
playlist->current */
int current_position = playlist->current >= 0
int current_position =
playlist->playing && playlist->current >= 0
? (int)queue_order_to_position(&playlist->queue,
playlist->current)
: -1;
......@@ -316,7 +317,8 @@ void setPlaylistRandomStatus(struct playlist *playlist, bool status)
current_position);
queue_swap_order(&playlist->queue, 0, current_order);
playlist->current = 0;
}
} else
playlist->current = -1;
} else
orderPlaylist(playlist);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment