Skip to content

Commit

Permalink
脚本: 切换 thumbfast 的开关时结束子进程
Browse files Browse the repository at this point in the history
可手动重置以解决缩略图突然卡死

联动脚本 uosc 的捷径修正
  • Loading branch information
hooke007 committed Apr 4, 2023
1 parent 20a5f55 commit 3eacfc7
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 11 deletions.
3 changes: 2 additions & 1 deletion portable_config/input_scripts.conf
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@

Ctrl+r script-message-to save_global_props clean_data # 清除已记录的属性值

Ctrl+t script-binding thumbfast/toggle # 临时显示/隐藏缩略图
Ctrl+Alt+t script-binding thumbfast/thumb_rerun # 重启缩略图的获取(修复缩略图卡死)
Ctrl+t script-binding thumbfast/thumb_toggle # 启用/禁用缩略图预览

MBTN_RIGHT script-binding uosc/menu # 唤起uosc的OSD上下文菜单 [右键-单击]
2 changes: 1 addition & 1 deletion portable_config/script-opts.conf
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,7 @@
script-opts-append = uosc-timeline_persistency=idle,audio
# 始终显示时间线的状态白名单,多个值用半角逗号分隔,默认 idle,audio 可用的其它值 paused image video

script-opts-append = uosc-controls=menu,script-stats,gap,play_pause,gap,subtitles,audio,<has_chapter>chapters,<has_many_edition>editions,<has_many_video>video,<stream>stream-quality,gap,space,speed,space,shuffle,loop-playlist,loop-file,gap,prev,items,next,gap,fullscreen
script-opts-append = uosc-controls=menu,ST-stats_tog,gap,play_pause,gap,subtitles,audio,<has_chapter>chapters,<has_many_edition>editions,<has_many_video>video,<stream>stream-quality,gap,space,speed,space,shuffle,loop-playlist,loop-file,gap,prev,items,next,gap,fullscreen
# 自定义时间线上方的控件按钮,多个值以半角逗号分隔。值 never 即禁用,示例即默认值
# 详参 “脚本选项的扩展说明” https://github.com/hooke007/MPV_lazy/discussions/186
script-opts-append = uosc-controls_size=32
Expand Down
2 changes: 1 addition & 1 deletion portable_config/script-opts/uosc.conf
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ timeline_persistency=idle,audio

# 自定义时间线上方的控件按钮,多个值以半角逗号分隔。值 never 即禁用,示例即默认值
# 详参 “脚本选项的扩展说明” https://github.com/hooke007/MPV_lazy/discussions/186
controls=menu,script-stats,gap,play_pause,gap,subtitles,audio,<has_chapter>chapters,<has_many_edition>editions,<has_many_video>video,<stream>stream-quality,gap,space,speed,space,shuffle,loop-playlist,loop-file,gap,prev,items,next,gap,fullscreen
controls=menu,ST-stats_tog,gap,play_pause,gap,subtitles,audio,<has_chapter>chapters,<has_many_edition>editions,<has_many_video>video,<stream>stream-quality,gap,space,speed,space,shuffle,loop-playlist,loop-file,gap,prev,items,next,gap,fullscreen
controls_size=32
controls_size_fullscreen=40
controls_margin=8
Expand Down
23 changes: 17 additions & 6 deletions portable_config/scripts/thumbfast.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@ COMMIT_ 08d81035bb5020f4caa326e642341f2e8af00ffe
适配多个OSC类脚本的新缩略图引擎
示例在 input.conf 中写入:
CTRL+t script-binding thumbfast/toggle # 临时显示/隐藏缩略图
]]--
Ctrl+Alt+t script-binding thumbfast/thumb_rerun # 重启缩略图的获取(修复缩略图卡死)
Ctrl+t script-binding thumbfast/thumb_toggle # 启用/禁用缩略图预览
]]

local options = {

Expand Down Expand Up @@ -635,13 +637,22 @@ mp.register_script_message("clear", clear)
mp.register_event("file-loaded", file_load)
mp.register_event("shutdown", shutdown)

mp.add_key_binding(nil, "toggle", function()
mp.add_key_binding(nil, "thumb_rerun", function()
clear()
shutdown()
auto_run = true
file_load()
mp.osd_message("缩略图功能已重启", 2)
end)
mp.add_key_binding(nil, "thumb_toggle", function()
if auto_run then
auto_run = false
mp.osd_message("缩略图功能已临时禁用", 2)
file_load()
shutdown()
mp.osd_message("缩略图功能已禁用", 2)
else
auto_run = true
mp.osd_message("缩略图功能已临时启用", 2)
file_load()
mp.osd_message("缩略图功能已启用", 2)
end
file_load()
end)
4 changes: 3 additions & 1 deletion portable_config/scripts/uosc/elements/Controls.lua
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,9 @@ function Controls:init()
deband = 'cycle:texture:deband:no/yes!?去色带',
deint = 'cycle:clear_all:deinterlace:no/yes!?反交错',
['shot-vid'] = 'command:screenshot:screenshot video?截屏',
['script-stats'] = 'command:info_outline:script-binding display-stats-toggle?统计数据',

['ST-stats_tog'] = 'command:info_outline:script-binding display-stats-toggle?统计数据',
['ST-thumb_tog'] = 'command:panorama:script-binding thumb_toggle?时间轴预览',

}

Expand Down
2 changes: 1 addition & 1 deletion portable_config/scripts/uosc/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ defaults = {
timeline_cache = true,
timeline_persistency = 'idle,audio',

controls = 'menu,script-stats,gap,play_pause,gap,subtitles,audio,<has_chapter>chapters,<has_many_edition>editions,<has_many_video>video,<stream>stream-quality,gap,space,speed,space,shuffle,loop-playlist,loop-file,gap,prev,items,next,gap,fullscreen',
controls = 'menu,ST-stats_tog,gap,play_pause,gap,subtitles,audio,<has_chapter>chapters,<has_many_edition>editions,<has_many_video>video,<stream>stream-quality,gap,space,speed,space,shuffle,loop-playlist,loop-file,gap,prev,items,next,gap,fullscreen',
controls_size = 32,
controls_size_fullscreen = 40,
controls_margin = 8,
Expand Down

0 comments on commit 3eacfc7

Please sign in to comment.