From 304e61574eb3bcd6b59b8a22a5043dcd6e17ca09 Mon Sep 17 00:00:00 2001 From: ange Date: Thu, 24 Jul 2025 14:17:01 +0000 Subject: [PATCH] feat: mpv function to auto add subtitles opt --- .config/bash/10-aliases.bash | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/.config/bash/10-aliases.bash b/.config/bash/10-aliases.bash index 993204b..69836b7 100644 --- a/.config/bash/10-aliases.bash +++ b/.config/bash/10-aliases.bash @@ -47,6 +47,19 @@ md2html() { ) done } +mpv() { + local a opt=() + + for a in "$@"; do + if [[ "$a" == *.srt ]] && [[ "$a" != --* ]]; then + opt+=(--sub-file="$a") + else + opt+=("$a") + fi + done + (set -x; command mpv "${opt[@]}") +} + update() { $TERM --hold -e "$SHELL" -xc "sudo pacman -Syu && echo $'\e[32mDONE'" & $TERM --hold -e "$SHELL" -xc "git --git-dir='$HOME/.dotfiles/' --work-tree='$HOME' submodule update --remote && echo $'\e[32mDONE'" &