aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/home/.config/mpv
diff options
context:
space:
mode:
authorLibravatar sommerfeld <sommerfeld@sommerfeld.dev>2026-04-21 01:23:18 +0100
committerLibravatar sommerfeld <sommerfeld@sommerfeld.dev>2026-04-21 01:23:18 +0100
commit9b2af4dd6c73ea57cc921f41120db7a2700e806d (patch)
tree66ee69c6d3ece244888ad4a44016e861700059ef /home/.config/mpv
parent288f0dd4757f373a4ef7293020d2be94c983f502 (diff)
downloaddotfiles-9b2af4dd6c73ea57cc921f41120db7a2700e806d.tar.gz
dotfiles-9b2af4dd6c73ea57cc921f41120db7a2700e806d.tar.bz2
dotfiles-9b2af4dd6c73ea57cc921f41120db7a2700e806d.zip
refactor: remove stow home/ directory (preparing for chezmoi source state)
Diffstat (limited to 'home/.config/mpv')
-rw-r--r--home/.config/mpv/input.conf96
-rw-r--r--home/.config/mpv/mpv.conf110
-rw-r--r--home/.config/mpv/scripts/webtorrent-hook.lua138
3 files changed, 0 insertions, 344 deletions
diff --git a/home/.config/mpv/input.conf b/home/.config/mpv/input.conf
deleted file mode 100644
index 679c4a2..0000000
--- a/home/.config/mpv/input.conf
+++ /dev/null
@@ -1,96 +0,0 @@
-# mpv keybindings
-#
-# Location of user-defined bindings: ~/.config/mpv/input.conf
-#
-# Lines starting with # are comments. Use SHARP to assign the # key.
-# Copy this file and uncomment and edit the bindings you want to change.
-#
-# List of commands and further details: DOCS/man/input.rst
-# List of special keys: --input-keylist
-# Keybindings testing mode: mpv --input-test --force-window --idle
-#
-# Use 'ignore' to unbind a key fully (e.g. 'ctrl+a ignore').
-#
-# Strings need to be quoted and escaped:
-# KEY show-text "This is a single backslash: \\ and a quote: \" !"
-#
-# You can use modifier-key combinations like Shift+Left or Ctrl+Alt+x with
-# the modifiers Shift, Ctrl, Alt and Meta (may not work on the terminal).
-#
-# The default keybindings are hardcoded into the mpv binary.
-# You can disable them completely with: --no-input-default-bindings
-
-# Mouse wheels, touchpad or other input devices that have axes
-# if the input devices supports precise scrolling it will also scale the
-# numeric value accordingly
-WHEEL_UP ignore
-WHEEL_DOWN ignore
-WHEEL_LEFT ignore
-WHEEL_RIGHT ignore
-
-## Seek units are in seconds, but note that these are limited by keyframes
-RIGHT seek 5
-LEFT seek -5
-UP seek 60
-DOWN seek -60
-# Do smaller, always exact (non-keyframe-limited), seeks with shift.
-# Don't show them on the OSD (no-osd).
-Shift+RIGHT no-osd seek 1 exact
-Shift+LEFT no-osd seek -1 exact
-Shift+UP no-osd seek 5 exact
-Shift+DOWN no-osd seek -5 exact
-# Skip to previous/next subtitle (subject to some restrictions; see manpage)
-Ctrl+LEFT no-osd sub-seek -1
-Ctrl+RIGHT no-osd sub-seek 1
-# Adjust timing to previous/next subtitle
-#Ctrl+Shift+LEFT sub-step -1
-#Ctrl+Shift+RIGHT sub-step 1
-[ multiply speed 1/1.1 # scale playback speed
-] multiply speed 1.1
-{ multiply speed 0.5
-} multiply speed 2.0
-BS set speed 1.0 # reset speed to normal
-Shift+BS revert-seek # undo previous (or marked) seek
-q quit
-Q quit-watch-later
-ESC set fullscreen no
-f cycle fullscreen # toggle fullscreen
-p cycle pause # toggle pause/playback mode
-> frame-step # advance one frame and pause
-< frame-back-step # go back by one frame and pause
-SPACE cycle pause
-O no-osd cycle-values osd-level 3 1 # cycle through OSD mode
-o show-progress
-P show-progress
-i script-binding stats/display-stats
-I script-binding stats/display-stats-toggle
-` script-binding console/enable
-. script-binding console/enable
-# z add sub-delay -0.1 # subtract 100 ms delay from subs
-# Z add sub-delay +0.1 # add
-#ctrl++ add audio-delay 0.100 # this changes audio/video sync
-#ctrl+- add audio-delay -0.100
-9 add volume -2
-0 add volume 2
-m cycle mute
-v cycle sub-visibility
-s cycle sub # cycle through subtitles
-S cycle sub down # ...backwards
-PLAY cycle pause
-PAUSE cycle pause
-PLAYPAUSE cycle pause
-PLAYONLY set pause no
-PAUSEONLY set pause yes
-STOP quit
-FORWARD seek 60
-REWIND seek -60
-NEXT playlist-next
-PREV playlist-prev
-VOLUME_UP add volume 2
-VOLUME_DOWN add volume -2
-MUTE cycle mute
-CLOSE_WIN quit
-CLOSE_WIN {encode} quit 4
-L cycle-values loop-file "inf" "no" # toggle infinite looping
-ctrl+c quit 4
-DEL script-binding osc/visibility # cycle OSC display
diff --git a/home/.config/mpv/mpv.conf b/home/.config/mpv/mpv.conf
deleted file mode 100644
index 890cbe3..0000000
--- a/home/.config/mpv/mpv.conf
+++ /dev/null
@@ -1,110 +0,0 @@
-# vim: syntax=config
-
-
-###########
-# General #
-###########
-
-input-ipc-server=/tmp/mpvsocket # listen for IPC on this socket
-save-position-on-quit # handled by a script
-
-# no-border # no window title bar
-msg-module # prepend module name to log messages
-msg-color # color log messages on terminal
-term-osd-bar # display a progress bar on the terminal
-use-filedir-conf # look for additional config files in the directory of the opened file
-#pause # no autoplay
-keep-open # keep the player open when a file's end is reached
-cursor-autohide=100 # autohide the curser after 1s
-prefetch-playlist=yes
-force-seekable=yes
-
-hls-bitrate=max # use max quality for HLS streams
-# not interested in getting videos with a resolution higher than 1080p
-ytdl-format=bv*[height<=1080]+ba/b[height<=1080]
-no-input-default-bindings
-script-opts=ytdl_hook-ytdl_path=yt-dlp
-
-[default]
-
-#########c
-# Cache #
-#########
-
-# Configure the cache to be really big (multiple GBs)
-# We have a lot of memory, so why not use it for something
-
-cache=yes
-# cache-default=1000000 # size in KB
-# cache-backbuffer=250000 # size in KB
-demuxer-max-bytes=1147483647 # ~1 GiB in bytes
-
-#############
-# Subtitles #
-#############
-
-sub-auto=fuzzy # external subs don't have to match the file name exactly to autoload
-sub-file-paths-append=ass # search for external subs in these relative subdirectories
-sub-file-paths-append=srt
-sub-file-paths-append=sub
-sub-file-paths-append=subs
-sub-file-paths-append=subtitles
-sub-file-paths-append=subtitle
-sub-file-paths-append=Ass # search for external subs in these relative subdirectories
-sub-file-paths-append=ASS # search for external subs in these relative subdirectories
-sub-file-paths-append=Srt
-sub-file-paths-append=SRT
-sub-file-paths-append=Sub
-sub-file-paths-append=SUB
-sub-file-paths-append=Subs
-sub-file-paths-append=SUBS
-sub-file-paths-append=Subtitles
-sub-file-paths-append=SUBTITLES
-sub-file-paths-append=Subtitle
-sub-file-paths-append=SUBTITLE
-
-
-#demuxer-mkv-subtitle-preroll # try to correctly show embedded subs when seeking
-#embeddedfonts=yes # use embedded fonts for SSA/ASS subs
-#sub-fix-timing=no # do not try to fix gaps (which might make it worse in some cases)
-#sub-ass-force-style=Kerning=yes # allows you to override style parameters of ASS scripts
-#sub-use-margins
-#sub-ass-force-margins
-
-#############
-# Languages #
-#############
-
-slang=en,eng # automatically select these subtitles (decreasing priority)
-# lang=en,eng # automatically select these audio tracks (decreasing priority)
-
-
-#########
-# Audio #
-#########
-
-audio-file-auto=fuzzy # external audio doesn't has to match the file name exactly to autoload
-audio-pitch-correction=yes # automatically insert scaletempo when playing with higher speed
-volume-max=200 # maximum volume in %, everything above 100 results in amplification
-volume=100 # default volume, 100 = unchanged
-
-
-################
-# Video Output #
-################
-
-hwdec=auto-safe
-
-[no-spoiler]
-osd-level=0
-no-osc
-no-osd-bar
-no-term-osd-bar
-quiet
-sub-auto=no
-
-[hq]
-profile=high-quality
-video-sync=display-resample
-interpolation
-tscale=oversample
diff --git a/home/.config/mpv/scripts/webtorrent-hook.lua b/home/.config/mpv/scripts/webtorrent-hook.lua
deleted file mode 100644
index 80d991f..0000000
--- a/home/.config/mpv/scripts/webtorrent-hook.lua
+++ /dev/null
@@ -1,138 +0,0 @@
--- TODO prefetch if next in playlist?
--- TODO handle torrent with multiple video files (if webtorrent can print json)
--- - don't close kill webtorrent while still videos unplayed? or in playlist?
--- - store titles/info when starting webtorrent and check stream-open-filename
--- for any item in playlist to see if it matches stored entry
-
-local settings = {
- close_webtorrent = true,
- remove_files = true,
- download_directory = "/tmp/webtorrent",
- webtorrent_flags = "",
- webtorrent_verbosity = "speed"
-}
-
-(require "mp.options").read_options(settings, "webtorrent-hook")
-
-local open_videos = {}
-
--- http://lua-users.org/wiki/StringRecipes
-local function ends_with(str, ending)
- return ending == "" or str:sub(-#ending) == ending
-end
-
--- https://stackoverflow.com/questions/132397/get-back-the-output-of-os-execute-in-lua
-function os.capture(cmd, decolorize, raw)
- if decolorize then
- -- https://github.com/webtorrent/webtorrent-cli/issues/132
- -- TODO webtorrent should have a way to just print json information with
- -- no colors
- -- https://stackoverflow.com/questions/19296667/remove-ansi-color-codes-from-a-text-file-using-bash/30938702#30938702
- cmd = cmd .. " | sed -r 's/\\x1B\\[(([0-9]{1,2})?(;)?([0-9]{1,2})?)?[m,K,H,f,J]//g'"
- end
- local f = assert(io.popen(cmd, 'r'))
- local s = assert(f:read('*a'))
- f:close()
- if raw then return s end
- s = string.gsub(s, '^%s+', '')
- s = string.gsub(s, '%s+$', '')
- -- s = string.gsub(s, '[\n\r]+', ' ')
- return s
-end
-
-function read_file(file)
- local fh = assert(io.open(file, "rb"))
- local contents = fh:read("*all")
- fh:close()
- return contents
-end
-
-function play_torrent()
- local url = mp.get_property("stream-open-filename")
- if (url:find("magnet:") == 1 or url:find("peerflix://") == 1
- or url:find("webtorrent://") == 1 or ends_with(url, "torrent")) then
- if url:find("webtorrent://") == 1 then
- url = url:sub(14)
- end
- if url:find("peerflix://") == 1 then
- url = url:sub(12)
- end
-
- os.execute("mkdir -p " .. settings.download_directory)
- -- don't reuse files (so multiple mpvs works)
- local output_file = settings.download_directory
- .. "/webtorrent-output-" .. mp.get_time() .. ".log"
- -- --keep-seeding is to prevent webtorrent from quitting once the download
- -- is done
- local webtorrent_command = "webtorrent "
- .. settings.webtorrent_flags
- .. " --out '" .. settings.download_directory .. "' --keep-seeding \""
- .. url .. "\" > " .. output_file .. " 2>&1 & echo $!"
- mp.msg.info("Starting webtorrent server")
- mp.msg.info(webtorrent_command)
- local pid = os.capture(webtorrent_command)
- mp.msg.info("Waiting for webtorrent server")
-
- local url_command = "tail -f " .. output_file
- .. " | awk '/Server running at:/ {print $4; exit}'"
- local url = os.capture(url_command, true)
- mp.msg.info("Webtorrent server is up")
-
- local title_command = "awk '/(Seeding|Downloading): / "
- .. "{gsub(/(Seeding|Downloading): /, \"\"); print; exit}' "
- .. output_file
- local title = os.capture(title_command, true)
- mp.msg.info("Setting media title to: " .. title)
- mp.set_property("force-media-title", title)
-
- local path
- if title then
- path = settings.download_directory .. "/\"" .. title .. "\""
- end
- open_videos[url] = {title=title,path=path,pid=pid}
-
- mp.set_property("stream-open-filename", url)
-
- if settings.webtorrent_verbosity == "speed" then
- local printer_pid
- local printer_pid_file = settings.download_directory
- .. "/webtorrent-printer-" .. mp.get_time() .. ".pid"
- os.execute("tail -f " .. output_file
- .. " | awk '/Speed:/' ORS='\r' & echo -n $! > "
- .. printer_pid_file)
- printer_pid = read_file(printer_pid_file)
- mp.register_event("file-loaded",
- function()
- os.execute("kill " .. printer_pid)
- end
- )
- end
- end
-end
-
-function webtorrent_cleanup()
- local url = mp.get_property("stream-open-filename")
- if settings.close_webtorrent and open_videos[url] then
- local title = open_videos[url].title
- local path = open_videos[url].path
- local pid = open_videos[url].pid
-
- if pid then
- mp.msg.info("Closing webtorrent for " .. title .. " with pid " .. pid)
- os.execute("kill " .. pid)
- end
-
- if settings.remove_files then
- if path then
- mp.msg.info("Removing media file for " .. title .. " with path " .. path)
- os.execute("rm -r " .. path)
- end
- end
-
- open_videos[url] = {}
- end
-end
-
-mp.add_hook("on_load", 50, play_torrent)
-
-mp.add_hook("on_unload", 10, webtorrent_cleanup)