From 8d1e06d9c27b5c7758025a0ee24e5503450872aa Mon Sep 17 00:00:00 2001 From: localhost_frssoft Date: Thu, 2 Mar 2023 20:58:22 +0300 Subject: [PATCH] Persistent cache disabled by default --- README.md | 2 +- src/mpv_control.py | 6 ++++-- src/settings.py | 1 + 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 45eb7bf..f8927ad 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ Python dependencies: Optional: brotli ### About cache folder -funkwhale-cli has to cache tracks before playing. Cache is persistent and you should manage it manually because the (script/program) can't clean it automatically. +funkwhale-cli has to cache tracks before playing (default disabled "enable_persistent_cache"). Cache is persistent and you should manage it manually because the (script/program) can't clean it automatically. Cache structure: cache/domain.tld/[track uuid] You can play tracks offline, example: mpv --shuffle cache/*/* cache_helper.sh - it might be useful for compression cache (lossy: vorbis 128 kbps, no thumbnail) diff --git a/src/mpv_control.py b/src/mpv_control.py index 4a562c9..0261c8e 100644 --- a/src/mpv_control.py +++ b/src/mpv_control.py @@ -11,8 +11,10 @@ import re fzf = FzfPrompt() -player = mpv.MPV(cache=True, demuxer_max_bytes=25*1024*1024, - scripts='src/mpv_scripts/mpv_cache.lua') +if get_config('enable_persistent_cache'): + player = mpv.MPV(cache=True, demuxer_max_bytes=25*1024*1024, scripts='src/mpv_scripts/mpv_cache.lua') +else: + player = mpv.MPV(cache=True, demuxer_max_bytes=25*1024*1024) player.ytdl = False # Prevent attempts load track with yt-dlp player.volume = get_config('mpv_volume') player.prefetch_playlist = get_config('prefetch_playlist') diff --git a/src/settings.py b/src/settings.py index 8fc1ff8..583e134 100644 --- a/src/settings.py +++ b/src/settings.py @@ -44,6 +44,7 @@ default_conf = { 'external_transcoder_http_proxy_path': "", 'track_activity_history': False, 'prefetch_playlist': True, + 'enable_persistent_cache': False, 'mpv_volume': 100, 'show_like_button': True, 'show_artist_name_in_albums': False