Skip to content

Commit f9ef63c

Browse files
committed
控制界面脚本:始终锁定属性 osc=no
mpv.conf 中不必手动设置 --osc=no
1 parent 4538ce5 commit f9ef63c

File tree

2 files changed

+7
-10
lines changed

2 files changed

+7
-10
lines changed

portable_config/mpv.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@
195195
#load-auto-profiles = no # <yes|no|默认auto> 新版条件配置预设(使用旧版外挂的用户记得禁用)
196196
#load-osd-console = no # 控制台
197197
#load-stats-overlay = no # 统计信息
198-
osc = no # [使用第三方OSC的前置条件] 禁用原OSC(即内置的"osc.lua"脚本)以兼容第三方的界面样式
198+
#osc = no # [使用部分同类脚本的前置条件] 禁用原OSC(即内置的"osc.lua"脚本)以兼容第三方的界面样式
199199
#ytdl = no # 网址解析增强
200200
#ytdl-raw-options-append = cookies=[D:/cookies.txt]
201201
# [当 --ytdl=yes 时有效] 将自定义的选项传递给ytdl https://github.com/ytdl-org/youtube-dl#options

portable_config/scripts/osc_lazy.lua

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,13 @@ COMMIT_ 20220720 7a9e348
99
SHIFT+DEL script-binding osc_lazy/visibility # 切换osc_lazy的可见性
1010
--]]
1111

12-
local orig_osc = mp.get_property('osc')
13-
if orig_osc == 'yes' then
14-
local err = "_____\n{\\1c&H0000FF&}注意:\n必须设置 {\\1c&H0000FF&}osc=no\n打开控制台查看更多信息"
15-
mp.set_osd_ass(1280, 720, err)
16-
mp.set_property('osc', 'no')
17-
mp.msg.warn("脚本已自动执行 osc=no 以临时兼容")
18-
mp.msg.warn("正确编辑 mpv.conf 重启程序即可")
19-
mp.msg.warn("不要在运行中更改参数 --osc 的状态")
20-
mp.msg.warn("注意其它osc类脚本亦不应共存")
12+
function lock_osc(name, value)
13+
if value == true then
14+
mp.set_property("osc", "no")
15+
mp.msg.info("脚本已自动执行 osc=no 以兼容")
16+
end
2117
end
18+
mp.observe_property("osc", "bool", lock_osc)
2219

2320
local ipairs,loadfile,pairs,pcall,tonumber,tostring = ipairs,loadfile,pairs,pcall,tonumber,tostring
2421
local debug,io,math,os,string,table,utf8 = debug,io,math,os,string,table,utf8

0 commit comments

Comments
 (0)