Skip to content

Commit 8cdbf55

Browse files
committed
脚本: 移除滤镜式次字幕的实现
https://mpv.io/manual/master/#options-secondary-sub-ass-override 现在应使用上述的原生方法作为替代
1 parent b6677b5 commit 8cdbf55

File tree

3 files changed

+0
-62
lines changed

3 files changed

+0
-62
lines changed

portable_config/input_scripts.conf

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,6 @@
3636
W script-binding load_plus/import_url # 使用PowerShell加载网址
3737
Ctrl+w script-binding load_plus/append_aid # 使用资源管理器加载其它音轨
3838
Alt+w script-binding load_plus/append_sid # 使用资源管理器加载其它字幕
39-
e script-binding load_plus/append_vfSub # 使用资源管理器加载/变更次字幕(滤镜型)
40-
E script-binding load_plus/toggle_vfSub # 隐藏/显示 当前的次字幕(滤镜型)
41-
Ctrl+e script-binding load_plus/remove_vfSub # 移除次字幕(滤镜型)
4239

4340
Shift+DEL script-binding osc_plus/visibility # 切换osc_plus的可见性
4441
Shift+Alt+DEL script-message-to osc_plus osc_layout slimbox # <bottombar|topbar|bottombox|box|slimbox> 切换 osc_plus 的布局为 slimbox

portable_config/scripts/contextmenu_gui/main.lua

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -679,9 +679,6 @@ local function playmenuList()
679679
{COMMAND, "【外置脚本】地址", "", "script-binding load_plus/import_url", "", false},
680680
{COMMAND, "【外置脚本】追加音轨", "", "script-binding load_plus/append_aid", "", false},
681681
{COMMAND, "【外置脚本】追加字幕轨", "", "script-binding load_plus/append_sid", "", false},
682-
{COMMAND, "【外置脚本】指定次字幕(滤镜)", "", "script-binding load_plus/append_vfSub", "", false},
683-
{COMMAND, "【外置脚本】显示/隐藏次字幕(滤镜)", "", "script-binding load_plus/toggle_vfSub", "", false},
684-
{COMMAND, "【外置脚本】移除次字幕(滤镜)", "", "script-binding load_plus/remove_vfSub", "", false},
685682
{SEP},
686683
{COMMAND, "播放列表乱序重排", "", "playlist-shuffle", "", false},
687684
{CHECK, "列表循环", "", "cycle-values loop-playlist inf no", function() return statePlayLoop() end, false, true},

portable_config/scripts/load_plus.lua

Lines changed: 0 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,6 @@ COMMIT_ 04fe818fc703d8c5dcc3a6aabe1caeed8286bdbb
1717
<KEY> script-binding load_plus/append_aid # 追加其它音轨(不切换)
1818
<KEY> script-binding load_plus/append_sid # 追加其它字幕(切换)
1919
20-
<KEY> script-binding load_plus/append_vfSub # 装载次字幕(滤镜型)
21-
<KEY> script-binding load_plus/toggle_vfSub # 隐藏/显示 当前的次字幕(滤镜型)
22-
<KEY> script-binding load_plus/remove_vfSub # 移除次字幕(滤镜型)
2320
]]
2421

2522
local msg = require "mp.msg"
@@ -530,56 +527,6 @@ function append_sid()
530527
end
531528
end
532529

533-
function append_vfSub()
534-
local was_ontop = mp.get_property_native("ontop")
535-
if was_ontop then mp.set_property_native("ontop", false) end
536-
local res = utils.subprocess({
537-
args = {'powershell', '-NoProfile', '-Command', [[& {
538-
Trap {
539-
Write-Error -ErrorRecord $_
540-
Exit 1
541-
}
542-
Add-Type -AssemblyName PresentationFramework
543-
$u8 = [System.Text.Encoding]::UTF8
544-
$out = [Console]::OpenStandardOutput()
545-
$ofd = New-Object -TypeName Microsoft.Win32.OpenFileDialog
546-
$ofd.Multiselect = $false
547-
If ($ofd.ShowDialog() -eq $true) {
548-
ForEach ($filename in $ofd.FileNames) {
549-
$u8filename = $u8.GetBytes("$filename")
550-
$out.Write($u8filename, 0, $u8filename.Length)
551-
}
552-
}
553-
}]]},
554-
cancellable = false,
555-
})
556-
if was_ontop then mp.set_property_native("ontop", true) end
557-
if (res.status ~= 0) then return end
558-
for filename in string.gmatch(res.stdout, '[^\n]+') do
559-
local vfSub = "vf append ``@LUA-load_plus:subtitles=filename=\"" .. res.stdout .. "\"``"
560-
mp.command(vfSub)
561-
end
562-
end
563-
564-
function filter_state(label, key, value)
565-
local filters = mp.get_property_native("vf")
566-
for _, filter in pairs(filters) do
567-
if filter["label"] == label and (not key or key and filter[key] == value) then
568-
return true
569-
end
570-
end
571-
return false
572-
end
573-
574-
function toggle_vfSub()
575-
local vfSub = "vf toggle @LUA-load_plus"
576-
if filter_state("LUA-load_plus") then mp.command(vfSub) end
577-
end
578-
579-
function remove_vfSub()
580-
local vfSub = "vf remove @LUA-load_plus"
581-
if filter_state("LUA-load_plus") then mp.command(vfSub) end
582-
end
583530

584531

585532
mp.register_event("end-file", remove_vfSub)
@@ -590,6 +537,3 @@ mp.add_key_binding(nil, "import_files", import_files)
590537
mp.add_key_binding(nil, "import_url", import_url)
591538
mp.add_key_binding(nil, "append_aid", append_aid)
592539
mp.add_key_binding(nil, "append_sid", append_sid)
593-
mp.add_key_binding(nil, "append_vfSub", append_vfSub)
594-
mp.add_key_binding(nil, "toggle_vfSub", toggle_vfSub)
595-
mp.add_key_binding(nil, "remove_vfSub", remove_vfSub)

0 commit comments

Comments
 (0)