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)
# 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:
),
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"],
)