Update mpv config

This commit is contained in:
rydesun 2026-06-29 23:02:32 +08:00
parent 9860cd648e
commit 113e1c4a39
2 changed files with 23 additions and 7 deletions

View file

@ -1,5 +1,17 @@
local mp = require 'mp' local mp = require 'mp'
local utils = require 'mp.utils' 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 function get_xattr_comment(path)
local p = io.popen(string.format( local p = io.popen(string.format(
@ -130,10 +142,10 @@ local function modify_current_title()
local current_chapter = get_current_and_next_chapter() local current_chapter = get_current_and_next_chapter()
if not current_chapter then return end if not current_chapter then return end
local res = utils.subprocess({ local cmd = {}
args = { "kdialog", "--inputbox", "编辑标题", current_chapter.title }, table.move(user_opts.edit_chapter_cmd, 1, #user_opts.edit_chapter_cmd, 1, cmd)
cancellable = false cmd[#cmd + 1] = current_chapter.title
}) local res = utils.subprocess({ args = cmd, cancellable = false })
if res.error or res.status ~= 0 then return end if res.error or res.status ~= 0 then return end
local input = res.stdout:gsub("^%s+", ""):gsub("%s+$", "") local input = res.stdout:gsub("^%s+", ""):gsub("%s+$", "")

View file

@ -5,13 +5,17 @@ script_dir=${config_dir}/scripts/
shader_dir=${config_dir}/shaders/ shader_dir=${config_dir}/shaders/
echo "Installing scripts..." 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" \ 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 https://github.com/christoph-heinrich/mpv-quality-menu/raw/refs/heads/master/quality-menu.lua
curl -fL --create-dirs -o "${script_dir}/thumbfast.lua" \ if [[ ! -f "/etc/mpv/scripts/thumbfast.lua" ]]; then
https://github.com/po5/thumbfast/raw/master/thumbfast.lua curl -fL --create-dirs -o "${script_dir}/thumbfast.lua" \
https://github.com/po5/thumbfast/raw/master/thumbfast.lua
fi
echo "Installing shaders..." echo "Installing shaders..."
curl -fL --create-dirs -o "${shader_dir}/FSRCNNX_x2_8-0-4-1.glsl" \ curl -fL --create-dirs -o "${shader_dir}/FSRCNNX_x2_8-0-4-1.glsl" \