Fix playback issues on Qobuz (#1147)
authorMarcel van der Veldt <m.vanderveldt@outlook.com>
Sat, 16 Mar 2024 09:11:21 +0000 (10:11 +0100)
committerGitHub <noreply@github.com>
Sat, 16 Mar 2024 09:11:21 +0000 (10:11 +0100)
music_assistant/server/helpers/audio.py
music_assistant/server/providers/qobuz/__init__.py

index 9550cace93bae47c2e35097f314da7a5e071e56e..defcffbdd27915dd0382cf7eab8ede30bcc3c8c2 100644 (file)
@@ -263,7 +263,7 @@ async def get_stream_details(mass: MusicAssistant, queue_item: QueueItem) -> Str
                 continue  # provider not available ?
             # prefer cache
             item_key = f"{music_prov.lookup_key}/{prov_media.item_id}"
-            cache_key = f"streamdetails_{item_key}"
+            cache_key = f"cached_streamdetails_{item_key}"
             if cache := await mass.cache.get(cache_key):
                 LOGGER.debug(f"Using cached streamdetails for {item_key}")
                 streamdetails = StreamDetails.from_dict(cache)
@@ -276,7 +276,9 @@ async def get_stream_details(mass: MusicAssistant, queue_item: QueueItem) -> Str
                 # store streamdetails in cache
                 expiration = streamdetails.expires - time()
                 if expiration > 300:
-                    await mass.cache.set(cache_key, streamdetails.to_dict(), expiration - 60)
+                    await mass.cache.set(
+                        cache_key, streamdetails.to_dict(), expiration=expiration - 60
+                    )
             except MusicAssistantError as err:
                 LOGGER.warning(str(err))
             else:
index e8f1cfc77b400790ecac22eae66167d9df51bdef..f4f20291c826cc88d252a7fc7098e1992d0f7f5a 100644 (file)
@@ -412,7 +412,7 @@ class QobuzProvider(MusicProvider):
             ),
             duration=streamdata["duration"],
             data=streamdata,  # we need these details for reporting playback
-            expires=time.time() + 3600,  # not sure about the real allowed value
+            expires=time.time() + 60,  # may not be cached
             direct=streamdata["url"],
         )