Skip to content

Commit

Permalink
Allow default value for CoverArtCache path (#2237)
Browse files Browse the repository at this point in the history
  • Loading branch information
pabera committed Feb 4, 2024
1 parent 2fe7055 commit 20389e3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
4 changes: 1 addition & 3 deletions src/jukebox/components/playermpd/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
8 changes: 6 additions & 2 deletions src/jukebox/components/playermpd/coverart_cache_manager.py
Original file line number Diff line number Diff line change
@@ -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):
Expand Down

0 comments on commit 20389e3

Please sign in to comment.