diff --git a/src/Instance.cxx b/src/Instance.cxx index cfe19fbb8..ab47105dd 100644 --- a/src/Instance.cxx +++ b/src/Instance.cxx @@ -66,7 +66,7 @@ Instance::OnDatabaseSongRemoved(const char *uri) sticker_song_delete(uri, IgnoreError()); #endif - partition->DeleteSong(uri); + partition->StaleSong(uri); } #endif diff --git a/src/Partition.hxx b/src/Partition.hxx index 666adfde9..5c9c12cfd 100644 --- a/src/Partition.hxx +++ b/src/Partition.hxx @@ -91,14 +91,10 @@ struct Partition final : QueueListener, PlayerListener, MixerListener { playlist.DeleteRange(pc, start, end); } -#ifdef ENABLE_DATABASE - - void DeleteSong(const char *uri) { - playlist.DeleteSong(pc, uri); + void StaleSong(const char *uri) { + playlist.StaleSong(pc, uri); } -#endif - void Shuffle(unsigned start, unsigned end) { playlist.Shuffle(pc, start, end); } diff --git a/src/queue/Playlist.hxx b/src/queue/Playlist.hxx index 16d449ba7..c588e092f 100644 --- a/src/queue/Playlist.hxx +++ b/src/queue/Playlist.hxx @@ -237,7 +237,13 @@ public: */ void DeleteRange(PlayerControl &pc, unsigned start, unsigned end); - void DeleteSong(PlayerControl &pc, const char *uri); + /** + * Mark the given song as "stale", i.e. as not being available + * anymore. This gets called when a song is removed from the + * database. The method attempts to remove all instances of + * this song from the queue. + */ + void StaleSong(PlayerControl &pc, const char *uri); void Shuffle(PlayerControl &pc, unsigned start, unsigned end); diff --git a/src/queue/PlaylistEdit.cxx b/src/queue/PlaylistEdit.cxx index f50eec144..2b0dbf2a4 100644 --- a/src/queue/PlaylistEdit.cxx +++ b/src/queue/PlaylistEdit.cxx @@ -310,7 +310,7 @@ playlist::DeleteId(PlayerControl &pc, unsigned id) } void -playlist::DeleteSong(PlayerControl &pc, const char *uri) +playlist::StaleSong(PlayerControl &pc, const char *uri) { for (int i = queue.GetLength() - 1; i >= 0; --i) if (queue.Get(i).IsURI(uri))