From: Marcel van der Veldt Date: Sun, 16 Mar 2025 08:33:21 +0000 (+0100) Subject: Fix: always check if cache path (still) exists X-Git-Url: https://git.kitaultman.com/?a=commitdiff_plain;h=fe2f980e47cab4c5a9dd4ee57a9a452209c098f6;p=music-assistant-server.git Fix: always check if cache path (still) exists --- diff --git a/music_assistant/helpers/audio.py b/music_assistant/helpers/audio.py index 3208e30f..52209c59 100644 --- a/music_assistant/helpers/audio.py +++ b/music_assistant/helpers/audio.py @@ -97,14 +97,14 @@ class StreamCache: # cache file already exists return # use cache controller to store the translation of uri-->cache file - if stored_cache_file := await self.mass.cache.get( - self.streamdetails.uri, base_key="audiocache" - ): + if ( + stored_cache_file := await self.mass.cache.get( + self.streamdetails.uri, base_key="audiocache" + ) + ) and await asyncio.to_thread(os.path.exists, stored_cache_file): # cache file already exists in memory self._cache_file = stored_cache_file - if await asyncio.to_thread(os.path.exists, self._cache_file): - # cache file already exists - return + return else: # create new cache file cache_id = shortuuid.random(30)