fix(genres): remove genres from playlog during restore (#3244)
authorJozef Kruszynski <60214390+jozefKruszynski@users.noreply.github.com>
Wed, 25 Feb 2026 20:01:21 +0000 (21:01 +0100)
committerGitHub <noreply@github.com>
Wed, 25 Feb 2026 20:01:21 +0000 (21:01 +0100)
music_assistant/controllers/media/genres.py

index fbd234d4ddd0cd20414372b1bb1d2ed77572893b..ebeea95964922201cad6018fb1b7a8606d64765d 100644 (file)
@@ -27,6 +27,7 @@ from music_assistant.constants import (
     DB_TABLE_GENRE_MEDIA_ITEM_MAPPING,
     DB_TABLE_GENRES,
     DB_TABLE_PLAYLISTS,
+    DB_TABLE_PLAYLOG,
     DB_TABLE_PODCASTS,
     DB_TABLE_RADIOS,
     DB_TABLE_TRACKS,
@@ -496,6 +497,9 @@ class GenreController(MediaControllerBase[Genre]):
         if full_restore:
             self.logger.warning("Performing FULL restore - deleting all existing genres")
             await self.mass.music.database.delete(DB_TABLE_GENRE_MEDIA_ITEM_MAPPING)
+            await self.mass.music.database.delete(
+                DB_TABLE_PLAYLOG, {"media_type": MediaType.GENRE.value}
+            )
             await self.mass.music.database.delete(DB_TABLE_GENRES)
             existing = set()
         else: