summaryrefslogtreecommitdiff
path: root/src/Instance.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'src/Instance.cxx')
-rw-r--r--src/Instance.cxx29
1 files changed, 22 insertions, 7 deletions
diff --git a/src/Instance.cxx b/src/Instance.cxx
index db81a2542..232cd21df 100644
--- a/src/Instance.cxx
+++ b/src/Instance.cxx
@@ -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