Ensure favorited item is added to provider library (#1207)
authorsprocket-9 <sprocketnumber9@gmail.com>
Mon, 8 Apr 2024 07:26:23 +0000 (08:26 +0100)
committerGitHub <noreply@github.com>
Mon, 8 Apr 2024 07:26:23 +0000 (09:26 +0200)
music_assistant/server/controllers/music.py

index ff568c0ebb6aa3405dfd297b8bdc66141da5b49c..db34f2f672fb206b81644d38443bd219b2f2a562 100644 (file)
@@ -345,6 +345,13 @@ class MusicController(CoreController):
         """Add an item to the favorites."""
         if isinstance(item, str):
             item = await self.get_item_by_uri(item)
+        # ensure item is added to streaming provider library
+        if (
+            (provider := self.mass.get_provider(item.provider))
+            and provider.is_streaming_provider
+            and provider.library_edit_supported(item.media_type)
+        ):
+            await provider.library_add(item.item_id, item.media_type)
         # make sure we have a full library item
         # a favorite must always be in the library
         full_item = await self.get_item(