aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2008-08-25 00:36:44 -0700
committerEric Wong <normalperson@yhbt.net>2008-08-25 00:36:44 -0700
commit3d15723da3723c08a8cb118cdfbbd238367f0a98 (patch)
tree118638e679b1ee78334542c6d24855c8b0045d4c /src
parenta81b1b674443eb80d9f5ee56f78cf3739adf4cfd (diff)
downloadmpd-3d15723da3723c08a8cb118cdfbbd238367f0a98.tar.gz
mpd-3d15723da3723c08a8cb118cdfbbd238367f0a98.tar.xz
mpd-3d15723da3723c08a8cb118cdfbbd238367f0a98.zip
playlist: fix "currentsong" after song movement
When moving songs around, we forgot to update the playlist.queue value, causing syncPlaylistWithQueue to trigger a false sync and screw with the playlist.current pointer; causing the currentsong command to return an incorrect song.
Diffstat (limited to '')
-rw-r--r--src/playlist.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/playlist.c b/src/playlist.c
index 7a9a0ea6c..1c743edc0 100644
--- a/src/playlist.c
+++ b/src/playlist.c
@@ -1056,6 +1056,7 @@ int moveSongInPlaylist(int fd, int from, int to)
Song *tmpSong;
int tmpId;
int currentSong;
+ int queued_is_current = (playlist.queued == playlist.current);
if (from < 0 || from >= playlist.length) {
commandError(fd, ACK_ERROR_NO_EXIST,
@@ -1085,7 +1086,7 @@ int moveSongInPlaylist(int fd, int from, int to)
to = (currentSong + abs(to)) % playlist.length;
}
- if (playlist_state == PLAYLIST_STATE_PLAY) {
+ if (playlist_state == PLAYLIST_STATE_PLAY && !queued_is_current) {
int queuedSong = -1;
if (playlist.queued >= 0)
@@ -1130,6 +1131,8 @@ int moveSongInPlaylist(int fd, int from, int to)
} else if (playlist.current >= to && playlist.current < from) {
playlist.current++;
}
+ if (queued_is_current)
+ playlist.queued = playlist.current;
}
queueNextSongInPlaylist();
incrPlaylistVersion();