Update mpv config

This commit is contained in:
rydesun 2024-04-18 20:02:34 +08:00
parent 41db1a0c0d
commit df7435a5bd
6 changed files with 43 additions and 54 deletions

View file

@ -1,13 +1,19 @@
UP add volume 2
DOWN add volume -2
UP add volume 2
DOWN add volume -2
WHEEL_UP seek 10
WHEEL_DOWN seek -10
Alt+LEFT add video-pan-x 0.01
Alt+RIGHT add video-pan-x -0.01
Alt+UP add video-pan-y 0.01
Alt+DOWN add video-pan-y -0.01
D cycle deband
T script-message-to Thumbnailer Thumbnailer-toggle-gen; script-message-to Thumbnailer Thumbnailer-toggle-osc
p script-binding uosc/items
o script-binding uosc/open-file
> script-binding uosc/next
< script-binding uosc/prev
Alt+d script-binding uosc/delete-file-next
ctrl+r cycle_values video-rotate "90" "180" "270" "0"
CTRL+1 apply-profile "common"; show_text ${glsl-shaders}

View file

@ -4,33 +4,24 @@ hwdec=auto-safe
# 播放完不关闭窗口
keep-open=yes
# ==== 界面 ====
# 浮动窗口的尺寸最大值
autofit-larger=90%x95%
# 使用脚本替代内置OSC
osc=no
# ==== OSD样式 ====
osd-on-seek=msg-bar
osd-font-size=25
osd-color='#eeeeee'
osd-border-size=2
osd-bar-h=2
osd-bar-w=60
# ==== 字幕 ====
# 使用脚本寻找外置字幕
# 使用 scripts/autoload_subtitles.lua 加载外置字幕
# 所以禁用mpv内置的自动加载方式
sub-auto=no
# 内置字幕优先使用中文
slang=sc,chs,chi,zh
slang=sc,chs,zh-hans,zh-cn,zh,chi,zho
# 尽量让ASS字幕在画面外
sub-ass-force-margins
# ==== 字幕样式 ====
sub-bold
sub-font-size=32
sub-color='#eeeeee'
sub-border-color='#565690'
sub-color='#e3e3bf'
sub-border-color='#4d4d5b9f'
sub-border-size=2
sub-shadow-color='#7676b0'
sub-shadow-color='#000000'
sub-shadow-offset=1
# ==== 路径 ====
@ -40,12 +31,8 @@ input-ipc-server=/tmp/mpvsocket
# 进度数据目录由脚本 scripts/xdg-dir.lua 控制
# ==== 渲染 ====
# 使用gpu-hq预设
profile=gpu-hq
# 影像升频算法
scale=ewa_lanczossharp
# 色度升频算法
cscale=ewa_lanczossharp
profile=high-quality
# 补帧算法
video-sync=display-resample
interpolation

View file

@ -1,4 +0,0 @@
auto_gen=no
auto_show=no
dimension=480
use_ffmpeg=yes

View file

@ -1 +0,0 @@
seekbarstyle=knob

View file

@ -5,6 +5,9 @@ local utils = require 'mp.utils'
local user_opts = {
max_distance = 2, -- 文件名的最大差异
max_distance_ratio = 0.5, -- 文件名的最大差异占比
video_types = {
'3g2', ' 3gp', ' asf', ' avi', ' f4v', ' flv', ' h264', ' h265', ' m2ts', ' m4v', ' mkv', ' mov', ' mp4', ' mp4v',
' mpeg', ' mpg', ' ogm', ' ogv', ' rm', ' rmvb', ' ts', ' vob', ' webm', ' wmv', ' y4m' },
}
local script_name = mp.get_script_name()
@ -38,24 +41,27 @@ end
local function similar_files(dir, filename)
local o_basename, o_ext = filename:match("(.+)%.(.+)")
local files = utils.readdir(dir, "files")
local res = {}
local res, skipped = {}, 0
for _, file in pairs(files) do
if file == filename then
table.insert(res, file)
goto continue
end
local basename, ext = file:match("(.+)%.(.+)")
ext = ext:lower()
if ext ~= o_ext then
goto continue
end
local distance = levenshtein_distance(basename, o_basename)
if distance <= user_opts.max_distance
or (distance/#o_basename <= user_opts.max_distance_ratio) then
table.insert(res, file)
else
local basename, ext = file:match("(.+)%.(.+)")
if ext ~= o_ext then
goto continue
end
local distance = levenshtein_distance(basename, o_basename)
if distance <= user_opts.max_distance
or (distance/#o_basename <= user_opts.max_distance_ratio) then
table.insert(res, file)
end
skipped = skipped + 1
end
::continue::
end
return res
return res, skipped
end
local function autoload_series()
@ -72,7 +78,7 @@ local function autoload_series()
return
end
local files = similar_files(dir, filename)
local files, skipped = similar_files(dir, filename)
table.sort(files, function(s1, s2)
if #s1 ~= #s2 then return #s1 < #s2 else return s1 < s2 end
end)
@ -83,6 +89,9 @@ local function autoload_series()
mp.commandv("playlist-move", 0, i)
end
end
if skipped > 0 then
mp.osd_message("skipped: ".. skipped, 3)
end
end
mp.register_event("start-file", autoload_series)

View file

@ -4,19 +4,11 @@ config_dir=${XDG_CONFIG_HOME:-~/.config}/mpv/
script_dir=${config_dir}/scripts/
shader_dir=${config_dir}/shaders/
echo "Updating scripts..."
curl -fL --create-dirs -o "${script_dir}/Thumbnailer.lua" \
https://github.com/deus0ww/mpv-conf/raw/master/scripts/Thumbnailer.lua
curl -fL --create-dirs -o "${script_dir}/Thumbnailer_OSC.lua" \
https://github.com/deus0ww/mpv-conf/raw/master/scripts/Thumbnailer_OSC.lua
curl -fL https://github.com/deus0ww/mpv-conf/raw/master/scripts/Thumbnailer_Worker.lua |
sed "s/'19'/'-19'/" > "${script_dir}/Thumbnailer_Worker.lua"
echo "Updating uosc..."
bash -c "$(curl -fL https://raw.githubusercontent.com/tomasklaen/uosc/HEAD/installers/unix.sh)"
curl -fL --create-dirs -o "${script_dir}/playlistmanager.lua" \
https://github.com/jonniek/mpv-playlistmanager/raw/master/playlistmanager.lua
curl -fL --create-dirs -o "${script_dir}/zenity-open-files.lua" \
https://github.com/alifarazz/mpv-zenity-open-files/raw/master/zenity-open-files.lua
curl -fL --create-dirs -o "${script_dir}/thumbfast.lua" \
https://github.com/po5/thumbfast/raw/master/thumbfast.lua
echo "Updating shaders..."
curl -fL --create-dirs -o "${shader_dir}/FSRCNNX_x2_8-0-4-1.glsl" \