From: Marcel van der Veldt Date: Tue, 9 Jul 2024 19:45:43 +0000 (+0200) Subject: some tweaks X-Git-Url: https://git.kitaultman.com/?a=commitdiff_plain;h=c577521412783776bc8ca62b9e6a9b972336bd3a;p=music-assistant-server.git some tweaks --- diff --git a/music_assistant/server/controllers/metadata.py b/music_assistant/server/controllers/metadata.py index 4680143f..b38b5ee1 100644 --- a/music_assistant/server/controllers/metadata.py +++ b/music_assistant/server/controllers/metadata.py @@ -423,8 +423,9 @@ class MetaDataController(CoreController): # to not overload the (free) metadata providers with api calls # TODO: Utilize a global (cloud) cache for metadata lookups to save on API calls - if self._online_slots_available and ( - force_refresh or (time() - (artist.metadata.last_refresh or 0)) > REFRESH_INTERVAL + if force_refresh or ( + self._online_slots_available + and ((time() - (artist.metadata.last_refresh or 0)) > REFRESH_INTERVAL) ): self._online_slots_available -= 1 # set timestamp, used to determine when this function was last called @@ -476,9 +477,9 @@ class MetaDataController(CoreController): # NOTE: we only allow this every REFRESH_INTERVAL and a max amount of calls per day # to not overload the (free) metadata providers with api calls # TODO: Utilize a global (cloud) cache for metadata lookups to save on API calls - if ( + if force_refresh or ( self._online_slots_available - and (force_refresh or (time() - (album.metadata.last_refresh or 0)) > REFRESH_INTERVAL) + and ((time() - (album.metadata.last_refresh or 0)) > REFRESH_INTERVAL) and (album.mbid or album.artists) ): self._online_slots_available -= 1 @@ -521,9 +522,9 @@ class MetaDataController(CoreController): # NOTE: we only allow this every REFRESH_INTERVAL and a max amount of calls per day # to not overload the (free) metadata providers with api calls # TODO: Utilize a global (cloud) cache for metadata lookups to save on API calls - if ( + if force_refresh or ( self._online_slots_available - and (force_refresh or (time() - (track.metadata.last_refresh or 0)) > REFRESH_INTERVAL) + and ((time() - (track.metadata.last_refresh or 0)) > REFRESH_INTERVAL) and (track.mbid or track.artists or track.album) ): self._online_slots_available -= 1