aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2009-02-11 18:02:50 +0100
committerMax Kellermann <max@duempel.org>2009-02-11 18:02:50 +0100
commit58a5d30826a1196948cff89135e9ac3c2a3e5333 (patch)
tree34010b5361d48bd82f705a35879e049321c9f2d0
parent9d447dda1da059105d0f5da92be384c5e2b57df3 (diff)
downloadmpd-58a5d30826a1196948cff89135e9ac3c2a3e5333.tar.gz
mpd-58a5d30826a1196948cff89135e9ac3c2a3e5333.tar.xz
mpd-58a5d30826a1196948cff89135e9ac3c2a3e5333.zip
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.
Diffstat (limited to '')
-rw-r--r--src/playlist.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/playlist.c b/src/playlist.c
index 4bdc0b4a8..138a92d01 100644
--- a/src/playlist.c
+++ b/src/playlist.c
@@ -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);