From 20389e3f3a18582bc21d2fb9b48978d8324a56b5 Mon Sep 17 00:00:00 2001 From: pabera <1260686+pabera@users.noreply.github.com> Date: Sun, 4 Feb 2024 21:11:45 +0100 Subject: [PATCH] Allow default value for CoverArtCache path (#2237) --- src/jukebox/components/playermpd/__init__.py | 4 +--- .../components/playermpd/coverart_cache_manager.py | 8 ++++++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/jukebox/components/playermpd/__init__.py b/src/jukebox/components/playermpd/__init__.py index 65c6e7267..49f630224 100644 --- a/src/jukebox/components/playermpd/__init__.py +++ b/src/jukebox/components/playermpd/__init__.py @@ -157,9 +157,7 @@ def __init__(self): self.decode_2nd_swipe_option() self.mpd_client = mpd.MPDClient() - - coverart_cache_path = cfg.getn('webapp', 'coverart_cache_path') - self.coverart_cache_manager = CoverartCacheManager(os.path.expanduser(coverart_cache_path)) + self.coverart_cache_manager = CoverartCacheManager() # The timeout refer to the low-level socket time-out # If these are too short and the response is not fast enough (due to the PI being busy), diff --git a/src/jukebox/components/playermpd/coverart_cache_manager.py b/src/jukebox/components/playermpd/coverart_cache_manager.py index 7883372ba..a7ae12eef 100644 --- a/src/jukebox/components/playermpd/coverart_cache_manager.py +++ b/src/jukebox/components/playermpd/coverart_cache_manager.py @@ -1,9 +1,13 @@ import os +import jukebox.cfghandler + +cfg = jukebox.cfghandler.get_handler('jukebox') class CoverartCacheManager: - def __init__(self, cache_folder_path): - self.cache_folder_path = cache_folder_path + def __init__(self): + coverart_cache_path = cfg.setndefault('webapp', 'coverart_cache_path', value='../../src/webapp/build/cover-cache') + self.cache_folder_path = os.path.expanduser(coverart_cache_path) def find_file_by_hash(self, hash_value): for filename in os.listdir(self.cache_folder_path):