summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar waker <wakeroid@gmail.com>2011-02-21 22:23:49 +0100
committerGravatar waker <wakeroid@gmail.com>2011-02-21 22:23:49 +0100
commit95be34c4fcb9e52a1d7fc5dbe36005c1adbd4593 (patch)
treead84b4ecf908b6e706d71a96be45ff013ce3dc8d
parent01d462cd0d8d9e43d4a4eab013af836cee0604e1 (diff)
don't tell streamer that tracks are removed while moving them
-rw-r--r--playlist.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/playlist.c b/playlist.c
index da766ada..def4754f 100644
--- a/playlist.c
+++ b/playlist.c
@@ -94,6 +94,8 @@ static playlist_t dummy_playlist; // used at startup to prevent crashes
static int pl_order; // mirrors "playback.order" config variable
+static int no_remove_notify;
+
void
pl_set_order (int order) {
if (pl_order != order && (pl_order == PLAYBACK_ORDER_SHUFFLE_TRACKS || PLAYBACK_ORDER_SHUFFLE_ALBUMS)) {
@@ -365,7 +367,6 @@ plt_remove (int plt) {
p = p->next;
}
streamer_notify_playlist_deleted (p);
-
if (!plt_loading) {
// move files (will decrease number of files by 1)
for (int i = plt+1; i < playlists_count; i++) {
@@ -1578,7 +1579,11 @@ int
plt_remove_item (playlist_t *playlist, playItem_t *it) {
if (!it)
return -1;
- streamer_song_removed_notify (it);
+
+ if (!no_remove_notify) {
+ streamer_song_removed_notify (it);
+ }
+
pl_playqueue_remove (it);
// remove from both lists
@@ -3206,6 +3211,7 @@ pl_set_cursor (int iter, int cursor) {
void
pl_move_items (int iter, int plt_from, playItem_t *drop_before, uint32_t *indexes, int count) {
GLOBAL_LOCK;
+
playlist_t *playlist = playlists_head;
playlist_t *to = plt_get_curr_ptr ();
@@ -3219,6 +3225,9 @@ pl_move_items (int iter, int plt_from, playItem_t *drop_before, uint32_t *indexe
return;
}
+ // don't let streamer think that current song was removed
+ no_remove_notify = 1;
+
// unlink items from playlist, and link together
playItem_t *head = NULL;
playItem_t *tail = NULL;
@@ -3249,6 +3258,7 @@ pl_move_items (int iter, int plt_from, playItem_t *drop_before, uint32_t *indexe
processed++;
}
}
+ no_remove_notify = 0;
GLOBAL_UNLOCK;
}