From fe2f980e47cab4c5a9dd4ee57a9a452209c098f6 Mon Sep 17 00:00:00 2001 From: Marcel van der Veldt Date: Sun, 16 Mar 2025 09:33:21 +0100 Subject: [PATCH] Fix: always check if cache path (still) exists --- music_assistant/helpers/audio.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) 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) -- 2.34.1