Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
补充 uosc 遗漏的上游提交
改进 #196
  • Loading branch information
hooke007 committed Oct 19, 2022
1 parent 5e56fdc commit a4fa635
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 30 deletions.
2 changes: 1 addition & 1 deletion portable_config/input_uosc.conf
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# script-binding uosc/subtitles #! 导航 > ※ 字幕轨列表
# playlist-shuffle #! 导航 > 播放列表乱序重排

# screenshot window #! 截屏 当前画面
# script-binding uosc/shot_250 #! ※ 截屏

# cycle-values hwdec "auto" "auto-copy" "no" #! 视频 > 切换 解码模式
# cycle deband #! 视频 > 切换 去色带状态
Expand Down
14 changes: 7 additions & 7 deletions portable_config/mpv.conf
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@
# 示例( cookies=[D:/cookies.txt] )仅为传递单个选项,多个选项最好独立追加,即写多个 --ytdl-raw-options-append 参数

load-scripts = yes # 自动挂载 /scripts/ 目录中的所有外置脚本,默认 yes。设置为no时可用下一行示例的命令加载指定的外置脚本
#scripts = "~~/scripts/load_plus.lua;~~/scripts/playlistmanager.lua"
scripts = "~~/scripts/xxxxx.lua;~~/scripts/yyyyy.lua"


##⇘⇘滤镜部分
Expand All @@ -220,20 +220,20 @@
##更多实用向的滤镜可参考 https://github.com/hooke007/MPV_lazy/discussions/120

vf = vflip
#vf-append = hflip
#vf-append = format=rotate=90
vf-append = hflip
vf-append = format=rotate=90


##⇘⇘着色器部分
##此处的 --glsl-shaders 用于指定每次随MPV共同启动的着色器(支持多项)。更多详细着色器信息参见 系列手册[01]
##--glsl-shaders-append 等效 --glsl-shader (注意和上行中参数的区别),表示追加着色器(单次仅能追加一项),并不会覆盖第一条 --glsl-shaders 指定的着色器,可无限追加该命令。

##初始加载多个着色器的示例写法
glsl-shaders = "~~/shaders/Anime4K_Clamp_Highlights.glsl;~~/shaders/Anime4K_Restore_CNN_M.glsl;~~/shaders/Anime4K_Upscale_CNN_x2_S.glsl"
glsl-shaders = "~~/shaders/aaaaa.glsl;~~/shaders/bbbbb.glsl;~~/shaders/ccccc.glsl"

##下接的逐个单项 --glsl-shaders-append (或 --glsl-shader ) 会依次排列在 --glsl-shaders 之后,当然你也可以不写 --glsl-shaders 只用前二者选项的队列
#glsl-shaders-append = "~~/shaders/KrigBilateral.glsl"
#glsl-shaders-append = "~~/shaders/AMD-FSR-EASU_luma.glsl"
glsl-shaders-append = "~~/shaders/ddddd.glsl"
glsl-shaders-append = "~~/shaders/eeeee.glsl"



Expand Down Expand Up @@ -296,7 +296,7 @@
########
# 截图 #
########
##⇘⇘以下预设参数是为了截取高质量的图片(输出质量越高,截图处理效率越低)
##⇘⇘截图的输出质量设定的越高,处理效率越低

screenshot-format = jpg # <默认 jpg|(同前)jpeg|png|webp|jxl>

Expand Down
56 changes: 34 additions & 22 deletions portable_config/scripts/uosc.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
--[[
SOURCE_ https://github.com/tomasklaen/uosc/commit/2fb5ff69a81e12f565f603cc0f29983235fce2ff
SOURCE_ https://github.com/tomasklaen/uosc/blob/main/scripts/uosc.lua
COMMIT_ 2fb5ff69a81e12f565f603cc0f29983235fce2ff
极简主义设计驱动的多功能界面脚本,兼容 thumbfast 新缩略图引擎
]]--
Expand Down Expand Up @@ -166,7 +167,7 @@ local defaults = {
timeline_chapters_opacity = 0.8,
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,shot,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_size = 32,
controls_size_fullscreen = 40,
controls_margin = 8,
Expand Down Expand Up @@ -266,7 +267,7 @@ local function create_default_menu()
{title = '※ 字幕轨列表', value = 'script-binding uosc/subtitles'},
{title = '播放列表乱序重排', value = 'playlist-shuffle'},
},},
{title = '截屏 当前画面', value = 'screenshot window'},
{title = '※ 截屏', value = 'script-binding uosc/shot_250'},
{title = '视频', items = {
{title = '切换 解码模式', value = 'cycle-values hwdec no auto auto-copy'},
{title = '切换 去色带状态', value = 'cycle deband'},
Expand Down Expand Up @@ -3278,6 +3279,7 @@ function Controls:init()
-- Serialize control elements
local shorthands = {
menu = 'command:menu:script-binding uosc/menu-blurred?菜单',
shot = 'command:screenshot_monitor:script-binding uosc/shot_1500?延迟截屏',
['script-stats'] = 'command:info_outline:script-binding stats/display-stats-toggle?统计数据',
['play_pause'] = 'cycle:not_started:pause:no=play_circle/yes=pause_circle?播放/暂停',
subtitles = 'command:subtitles:script-binding uosc/subtitles#sub>0?字幕轨',
Expand Down Expand Up @@ -4268,26 +4270,22 @@ end
if options.click_threshold > 0 then
-- Executes custom command for clicks shorter than `options.click_threshold`
-- while filtering out double clicks.
local duration_seconds = options.click_threshold / 1000
local last_click = 0
mp.add_key_binding('mbtn_left', 'uosc_mouse', function(tab)
if tab.event == 'up' then
local delta = mp.get_time() - last_click
-- in windowed mode the up event comes shortly after the down event, ignore
if delta > 0.01 and delta < duration_seconds then
last_click = 0
mp.command(options.click_command)
end
else
last_click = mp.get_time()
end
end, {complex = true})
mp.observe_property('mouse-pos', 'native', function(_, mouse)
if mouse.hover and mp.get_time() - last_click < duration_seconds then
last_click = 0
mp.command(options.click_command)
end
local click_time = options.click_threshold / 1000
local doubleclick_time = mp.get_property_native('input-doubleclick-time') / 1000
local last_down, last_up = 0, 0
local click_timer = mp.add_timeout(math.max(click_time, doubleclick_time), function()
local delta = last_up - last_down
if delta > 0 and delta < click_time and delta > 0.02 then mp.command(options.click_command) end
end)
click_timer:kill()
mp.set_key_bindings({{'mbtn_left',
function() last_up = mp.get_time() end,
function()
last_down = mp.get_time()
if click_timer:is_enabled() then click_timer:kill() else click_timer:resume() end
end,
},}, 'mouse_movement', 'force')
mp.enable_key_bindings('mouse_movement', 'allow-vo-dragging+allow-hide-cursor')
end

mp.observe_property('mouse-pos', 'native', function(_, mouse)
Expand Down Expand Up @@ -4776,6 +4774,20 @@ mp.add_key_binding(nil, 'open-config-directory', function()
msg.error('Couldn\'t serialize config path "' .. config_path .. '".')
end
end)
-- 特殊截屏
function shot_later(num)
local paused = mp.get_property_bool('pause')
local bak_pause_indicator = options.pause_indicator
if not paused then
options.pause_indicator = 'manual'
mp.set_property_bool('pause', true)
mp.add_timeout(num / 1000, function() mp.command('screenshot window') mp.set_property_bool('pause', false) options.pause_indicator = bak_pause_indicator end)
else
mp.add_timeout(num / 1000, function() mp.command('screenshot window') end)
end
end
mp.add_key_binding(nil, 'shot_250', function() shot_later(250) end)
mp.add_key_binding(nil, 'shot_1500', function() shot_later(1500) end)

-- 空闲自动弹出上下文菜单
if type(options.idle_call_menu) == 'number' then
Expand Down

0 comments on commit a4fa635

Please sign in to comment.