diff --git a/src/music_kraken/__main__.py b/src/music_kraken/__main__.py index 9da441d..ee4b3fb 100644 --- a/src/music_kraken/__main__.py +++ b/src/music_kraken/__main__.py @@ -125,10 +125,12 @@ def cli(): cli.set_frontend(silent=False) if arguments.clear_cache: - cli.clear_cache() + from .cli.options import cache + cache.clear_cache() if arguments.clean_cache: - cli.clean_cache() + from .cli.options import cache + cache.clean_cache() # getting the genre genre: str = arguments.genre diff --git a/src/music_kraken/cli/options/cache.py b/src/music_kraken/cli/options/cache.py index 103696b..42cb76b 100644 --- a/src/music_kraken/cli/options/cache.py +++ b/src/music_kraken/cli/options/cache.py @@ -1,8 +1,10 @@ from logging import getLogger +from ..utils import cli_function from ...connection.cache import Cache +@cli_function def clear_cache(): """ Deletes the cache. @@ -10,8 +12,10 @@ def clear_cache(): """ Cache("main", getLogger("cache")).clear() + print("Cleared cache") +@cli_function def clean_cache(): """ Deletes the outdated cache. (all expired cached files, and not indexed files) @@ -19,3 +23,4 @@ def clean_cache(): """ Cache("main", getLogger("cache")).clean() + print("Cleaned cache") diff --git a/src/music_kraken/connection/cache.py b/src/music_kraken/connection/cache.py index 585b4e8..eaeee9d 100644 --- a/src/music_kraken/connection/cache.py +++ b/src/music_kraken/connection/cache.py @@ -145,6 +145,9 @@ class Cache: keep = set() for ca in self.cached_attributes.copy(): + if ca.name == "": + continue + file = Path(self._dir, ca.module, ca.name) if not ca.is_valid: