db/DatabaseListener: add method OnDatabaseSongRemoved()
Decouples db/update/Remove.cpp from global variables.
This commit is contained in:
@@ -22,9 +22,15 @@
|
||||
#include "Partition.hxx"
|
||||
#include "Idle.hxx"
|
||||
#include "Stats.hxx"
|
||||
#include "db/DatabaseError.hxx"
|
||||
|
||||
#ifdef ENABLE_DATABASE
|
||||
#include "db/DatabaseError.hxx"
|
||||
#include "db/LightSong.hxx"
|
||||
|
||||
#ifdef ENABLE_SQLITE
|
||||
#include "sticker/StickerDatabase.hxx"
|
||||
#include "sticker/SongSticker.hxx"
|
||||
#endif
|
||||
|
||||
Database *
|
||||
Instance::GetDatabase(Error &error)
|
||||
@@ -34,12 +40,6 @@ Instance::GetDatabase(Error &error)
|
||||
return database;
|
||||
}
|
||||
|
||||
void
|
||||
Instance::DeleteSong(const char *uri)
|
||||
{
|
||||
partition->DeleteSong(uri);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void
|
||||
@@ -68,6 +68,21 @@ Instance::OnDatabaseModified()
|
||||
idle_add(IDLE_DATABASE);
|
||||
}
|
||||
|
||||
void
|
||||
Instance::OnDatabaseSongRemoved(const LightSong &song)
|
||||
{
|
||||
assert(database != nullptr);
|
||||
|
||||
#ifdef ENABLE_SQLITE
|
||||
/* if the song has a sticker, remove it */
|
||||
if (sticker_enabled())
|
||||
sticker_song_delete(song);
|
||||
#endif
|
||||
|
||||
const auto uri = song.GetURI();
|
||||
partition->DeleteSong(uri.c_str());
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_NEIGHBOR_PLUGINS
|
||||
|
Reference in New Issue
Block a user