dotfiles

personal dotfiles
git clone anongit@rnpnr.xyz:dotfiles.git
Log | Files | Refs | Feed | Submodules

Commit: 1427585fab34c7d596fe82c4b26c5ed15ad697dc
Parent: 1594abf83c57ab42adb87d7113d7e142f3cddccf
Author: Randy Palamar
Date:   Fri, 19 Jan 2024 21:22:16 -0700

mpv: add status-line script and bump others

Diffstat:
M.config/mpv/input.conf | 4++++
M.config/mpv/mpv.conf | 4++--
A.config/mpv/scripts/status-line.lua | 38++++++++++++++++++++++++++++++++++++++
3 files changed, 44 insertions(+), 2 deletions(-)

diff --git a/.config/mpv/input.conf b/.config/mpv/input.conf @@ -10,6 +10,9 @@ l script-binding chapter_next T script-binding mpv_toolbox/tracklist +p add sub-pos +1 +P add sub-pos -1 + r cycle-values video-rotate "90" "180" "270" "no" R cycle-values video-rotate "no" "270" "180" "90" @@ -20,6 +23,7 @@ x sub-step -1 U cycle-values sub-color "#DCDCCC" "#F0E118" ; cycle-values loop "inf" "no" +\ cycle-values vo "null" "gpu-next" F1 cycle stop-screensaver F4 rescan-external-files keep-selection diff --git a/.config/mpv/mpv.conf b/.config/mpv/mpv.conf @@ -13,10 +13,8 @@ volume-max=200 audio-channels=2 af=format=channels=2 -# Default lang alang=jp,jpn,ja slang=jp,jpn,ja -sub-forced-only no-sub-visibility # UI @@ -42,6 +40,8 @@ ytdl-raw-options='yes-playlist=' loop-playlist=inf cover-art-auto=no +demuxer-hysteresis-secs=60 + [ytmus] ytdl-format='(bestvideo[height<=?480]+bestaudio)/best' diff --git a/.config/mpv/scripts/status-line.lua b/.config/mpv/scripts/status-line.lua @@ -0,0 +1,38 @@ +-- generates a status line useful when running mpv +-- headless from the terminal as a music player +-- updates once per second and pauses with player + +local chapter_str = "" +mp.observe_property("chapter", "number", function(_, cn) + if cn == nil then chapter_str = "" return end + local c = "\n> [" .. cn + 1 .. "/" + c = c .. mp.get_property_osd("chapters") .. "] " + c = c .. mp.get_property_osd("chapter-metadata/by-key/title") + chapter_str = c +end) + +local status_line = function() + local status = "" + local append = function(s) status = status .. s end + append("> " .. mp.get_property_osd("media-title")) + append(chapter_str) + append("\n> " .. mp.get_property_osd("time-pos")) + append("/" .. mp.get_property_osd("duration")) + append(" (Cached: " .. mp.get_property_osd("demuxer-cache-duration")) + append(")") + mp.set_property("options/term-status-msg", status) +end + +timer = mp.add_periodic_timer(1, status_line) + +local pause = function(_, paused) + if paused then + timer:stop() + else + timer:resume() + end + mp.add_timeout(0.1, status_line) +end + +mp.observe_property("pause", "bool", pause) +mp.register_event("seek", status_line)