From 113e1c4a39e1b9b25da1bbe5e8b8f9d56762f295 Mon Sep 17 00:00:00 2001 From: rydesun Date: Mon, 29 Jun 2026 23:02:32 +0800 Subject: [PATCH] Update mpv config --- .config/mpv/scripts/timeline-marker.lua | 20 +++++++++++++++---- .../mpv/tools/install-scripts-and-shaders.sh | 10 +++++++--- 2 files changed, 23 insertions(+), 7 deletions(-) diff --git a/.config/mpv/scripts/timeline-marker.lua b/.config/mpv/scripts/timeline-marker.lua index cbf5a83..9308237 100644 --- a/.config/mpv/scripts/timeline-marker.lua +++ b/.config/mpv/scripts/timeline-marker.lua @@ -1,5 +1,17 @@ local mp = require 'mp' local utils = require 'mp.utils' +local opt = require 'mp.options' + +local user_opts = { + edit_chapter_cmd = { "kdialog", "--inputbox", "编辑标题" }, +} + +local script_name = mp.get_script_name() +local raw_user_opts = { edit_chapter_cmd = '' } +opt.read_options(raw_user_opts, script_name) +if raw_user_opts.edit_chapter_cmd ~= "" then + user_opts.edit_chapter_cmd = utils.parse_json(raw_user_opts.edit_chapter_cmd) +end local function get_xattr_comment(path) local p = io.popen(string.format( @@ -130,10 +142,10 @@ local function modify_current_title() local current_chapter = get_current_and_next_chapter() if not current_chapter then return end - local res = utils.subprocess({ - args = { "kdialog", "--inputbox", "编辑标题", current_chapter.title }, - cancellable = false - }) + local cmd = {} + table.move(user_opts.edit_chapter_cmd, 1, #user_opts.edit_chapter_cmd, 1, cmd) + cmd[#cmd + 1] = current_chapter.title + local res = utils.subprocess({ args = cmd, cancellable = false }) if res.error or res.status ~= 0 then return end local input = res.stdout:gsub("^%s+", ""):gsub("%s+$", "") diff --git a/.config/mpv/tools/install-scripts-and-shaders.sh b/.config/mpv/tools/install-scripts-and-shaders.sh index 4233e88..db239d0 100755 --- a/.config/mpv/tools/install-scripts-and-shaders.sh +++ b/.config/mpv/tools/install-scripts-and-shaders.sh @@ -5,13 +5,17 @@ script_dir=${config_dir}/scripts/ shader_dir=${config_dir}/shaders/ echo "Installing scripts..." -bash -c "$(curl -fL https://raw.githubusercontent.com/tomasklaen/uosc/HEAD/installers/unix.sh)" +if [[ ! -d "/etc/mpv/scripts/uosc/" ]]; then + bash -c "$(curl -fL https://raw.githubusercontent.com/tomasklaen/uosc/HEAD/installers/unix.sh)" +fi curl -fL --create-dirs -o "${script_dir}/quality-menu.lua" \ https://github.com/christoph-heinrich/mpv-quality-menu/raw/refs/heads/master/quality-menu.lua -curl -fL --create-dirs -o "${script_dir}/thumbfast.lua" \ - https://github.com/po5/thumbfast/raw/master/thumbfast.lua +if [[ ! -f "/etc/mpv/scripts/thumbfast.lua" ]]; then + curl -fL --create-dirs -o "${script_dir}/thumbfast.lua" \ + https://github.com/po5/thumbfast/raw/master/thumbfast.lua +fi echo "Installing shaders..." curl -fL --create-dirs -o "${shader_dir}/FSRCNNX_x2_8-0-4-1.glsl" \