Skip to content

Commit

Permalink
Fix playback issues on Qobuz (music-assistant#1147)
Browse files Browse the repository at this point in the history
  • Loading branch information
marcelveldt authored Mar 16, 2024
1 parent d11c47d commit 9f4298d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions music_assistant/server/helpers/audio.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion music_assistant/server/providers/qobuz/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ async def get_stream_details(self, item_id: str) -> StreamDetails:
),
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"],
)

Expand Down

0 comments on commit 9f4298d

Please sign in to comment.