From 640242dad528b1f2eb27cfa139897a88d6eddab7 Mon Sep 17 00:00:00 2001 From: localhost_frssoft Date: Thu, 22 Dec 2022 03:23:09 +0300 Subject: [PATCH] Change cache policy (max 25 MB); Pring loading state --- src/mpv_control.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/mpv_control.py b/src/mpv_control.py index 820d0b7..b780e5e 100644 --- a/src/mpv_control.py +++ b/src/mpv_control.py @@ -9,7 +9,7 @@ import sys fzf = FzfPrompt() -player = mpv.MPV(cache_secs=10) +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') @@ -62,6 +62,14 @@ def osd_observer(_name, value): print_there(0, 0, '\r'+' — '.join(osd_message)) +@player.property_observer('stream-open-filename') +@logger.catch +def waiting_load_observer(_name, value): + '''just show loading state''' + if value and player.core_idle: + print_there(0, 0, '\rLoading track...') + + @player.property_observer('percent-pos') @logger.catch def universal_observer(_name, value):