playlist: call clearPlayerQueue() only if song is queued II
This patch extends commit 35a16b99
, and amends several 2 missing
checks. It simplifies 2 more checks by merging "if" conditions.
This commit is contained in:
@@ -979,11 +979,8 @@ enum playlist_result moveSongInPlaylist(unsigned from, int to)
|
|||||||
to = (currentSong + abs(to)) % playlist.length;
|
to = (currentSong + abs(to)) % playlist.length;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (playlist_state == PLAYLIST_STATE_PLAY) {
|
if (playlist_state == PLAYLIST_STATE_PLAY && playlist.queued >= 0) {
|
||||||
int queuedSong = -1;
|
int queuedSong = playlist.order[playlist.queued];
|
||||||
|
|
||||||
if (playlist.queued >= 0)
|
|
||||||
queuedSong = playlist.order[playlist.queued];
|
|
||||||
if (queuedSong == (int)from || queuedSong == to
|
if (queuedSong == (int)from || queuedSong == to
|
||||||
|| currentSong == from || (int)currentSong == to)
|
|| currentSong == from || (int)currentSong == to)
|
||||||
clearPlayerQueue();
|
clearPlayerQueue();
|
||||||
@@ -1062,10 +1059,8 @@ static void orderPlaylist(void)
|
|||||||
if (playlist.current >= 0 && playlist.current < (int)playlist.length)
|
if (playlist.current >= 0 && playlist.current < (int)playlist.length)
|
||||||
playlist.current = playlist.order[playlist.current];
|
playlist.current = playlist.order[playlist.current];
|
||||||
|
|
||||||
if (playlist_state == PLAYLIST_STATE_PLAY) {
|
if (playlist_state == PLAYLIST_STATE_PLAY && playlist.queued >= 0)
|
||||||
if (playlist.queued >= 0)
|
clearPlayerQueue();
|
||||||
clearPlayerQueue();
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i = 0; i < playlist.length; i++) {
|
for (i = 0; i < playlist.length; i++) {
|
||||||
playlist.order[i] = i;
|
playlist.order[i] = i;
|
||||||
@@ -1087,10 +1082,9 @@ static void randomizeOrder(int start, int end)
|
|||||||
|
|
||||||
DEBUG("playlist: randomize from %i to %i\n", start, end);
|
DEBUG("playlist: randomize from %i to %i\n", start, end);
|
||||||
|
|
||||||
if (playlist_state == PLAYLIST_STATE_PLAY) {
|
if (playlist_state == PLAYLIST_STATE_PLAY &&
|
||||||
if (playlist.queued >= start && playlist.queued <= end)
|
playlist.queued >= start && playlist.queued <= end)
|
||||||
clearPlayerQueue();
|
clearPlayerQueue();
|
||||||
}
|
|
||||||
|
|
||||||
for (i = start; i <= end; i++) {
|
for (i = start; i <= end; i++) {
|
||||||
ri = random() % (end - start + 1) + start;
|
ri = random() % (end - start + 1) + start;
|
||||||
@@ -1158,7 +1152,9 @@ void shufflePlaylist(void)
|
|||||||
|
|
||||||
if (playlist.length > 1) {
|
if (playlist.length > 1) {
|
||||||
if (playlist_state == PLAYLIST_STATE_PLAY) {
|
if (playlist_state == PLAYLIST_STATE_PLAY) {
|
||||||
clearPlayerQueue();
|
if (playlist.queued >= 0)
|
||||||
|
clearPlayerQueue();
|
||||||
|
|
||||||
/* put current playing song first */
|
/* put current playing song first */
|
||||||
swapSongs(0, playlist.order[playlist.current]);
|
swapSongs(0, playlist.order[playlist.current]);
|
||||||
if (playlist.random) {
|
if (playlist.random) {
|
||||||
|
Reference in New Issue
Block a user