Fix in_library mapping on first sync
authorMarcel van der Veldt <m.vanderveldt@outlook.com>
Tue, 16 Dec 2025 22:50:55 +0000 (23:50 +0100)
committerMarcel van der Veldt <m.vanderveldt@outlook.com>
Tue, 16 Dec 2025 22:50:55 +0000 (23:50 +0100)
music_assistant/controllers/media/base.py

index a60d9f7955547b1a622a68827597d9842d89a3ee..517f75ddbf979cdb6b9892ed33d0be9fc7bc58a2 100644 (file)
@@ -129,6 +129,9 @@ class MediaControllerBase[ItemCls: "MediaItemType"](metaclass=ABCMeta):
             # update existing item
             await self._update_library_item(library_id, item, overwrite=overwrite_existing)
         else:
+            for provider_mapping in item.provider_mappings:
+                if item.item_id == provider_mapping.item_id:
+                    provider_mapping.in_library = True
             # actually add a new item in the library db
             self.mass.music.match_provider_instances(item)
             async with self._db_add_lock: