queue/Playlist: rename DeleteSong() to StaleSong()

This commit is contained in:
Max Kellermann 2016-03-18 18:01:01 +01:00
parent 91fb7fa3d8
commit f37a1026f9
4 changed files with 11 additions and 9 deletions

View File

@ -66,7 +66,7 @@ Instance::OnDatabaseSongRemoved(const char *uri)
sticker_song_delete(uri, IgnoreError()); sticker_song_delete(uri, IgnoreError());
#endif #endif
partition->DeleteSong(uri); partition->StaleSong(uri);
} }
#endif #endif

View File

@ -91,14 +91,10 @@ struct Partition final : QueueListener, PlayerListener, MixerListener {
playlist.DeleteRange(pc, start, end); playlist.DeleteRange(pc, start, end);
} }
#ifdef ENABLE_DATABASE void StaleSong(const char *uri) {
playlist.StaleSong(pc, uri);
void DeleteSong(const char *uri) {
playlist.DeleteSong(pc, uri);
} }
#endif
void Shuffle(unsigned start, unsigned end) { void Shuffle(unsigned start, unsigned end) {
playlist.Shuffle(pc, start, end); playlist.Shuffle(pc, start, end);
} }

View File

@ -237,7 +237,13 @@ public:
*/ */
void DeleteRange(PlayerControl &pc, unsigned start, unsigned end); 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); void Shuffle(PlayerControl &pc, unsigned start, unsigned end);

View File

@ -310,7 +310,7 @@ playlist::DeleteId(PlayerControl &pc, unsigned id)
} }
void void
playlist::DeleteSong(PlayerControl &pc, const char *uri) playlist::StaleSong(PlayerControl &pc, const char *uri)
{ {
for (int i = queue.GetLength() - 1; i >= 0; --i) for (int i = queue.GetLength() - 1; i >= 0; --i)
if (queue.Get(i).IsURI(uri)) if (queue.Get(i).IsURI(uri))