chore(modernx): bump to v0.6.1

This commit is contained in:
2024-04-26 01:24:04 +02:00
parent 20a24fb101
commit b9248e4c33
2 changed files with 55 additions and 54 deletions
+1 -1
View File
@@ -76,7 +76,7 @@ This project includes third party software from the projects listed below.
### Scripts ### Scripts
* [autosubsync-mpv](https://github.com/joaquintorres/autosubsync-mpv) v0.33 * [autosubsync-mpv](https://github.com/joaquintorres/autosubsync-mpv) v0.33
* [mpv-autosub](https://github.com/davidde/mpv-autosub) based on commit 35115355bd339681f97d067538356c29e5b14afa * [mpv-autosub](https://github.com/davidde/mpv-autosub) based on commit 35115355bd339681f97d067538356c29e5b14afa
* [ModernX](https://github.com/cyl0/ModernX) v0.6.0 * [ModernX](https://github.com/cyl0/ModernX) v0.6.1
* [repl.lua](https://github.com/rossy/mpv-repl) based on commit f7538adea92b441f2c7edd5dc07dd50dac28d3d5 * [repl.lua](https://github.com/rossy/mpv-repl) based on commit f7538adea92b441f2c7edd5dc07dd50dac28d3d5
* [thumbfast](https://github.com/po5/thumbfast) based on commit 03e93feee5a85bf7c65db953ada41b4826e9f905 * [thumbfast](https://github.com/po5/thumbfast) based on commit 03e93feee5a85bf7c65db953ada41b4826e9f905
+54 -53
View File
@@ -37,8 +37,8 @@ local user_opts = {
seekrange = true, -- show seekrange overlay seekrange = true, -- show seekrange overlay
seekrangealpha = 64, -- transparency of seekranges seekrangealpha = 64, -- transparency of seekranges
seekbarkeyframes = true, -- use keyframes when dragging the seekbar seekbarkeyframes = true, -- use keyframes when dragging the seekbar
showjump = true, -- show "jump forward/backward 5 seconds" buttons showjump = true, -- show "jump forward/backward 5 seconds" buttons
-- shift+left-click to step 1 frame and -- shift+left-click to step 1 frame and
-- right-click to jump 1 minute -- right-click to jump 1 minute
jumpamount = 5, -- change the jump amount (in seconds by default) jumpamount = 5, -- change the jump amount (in seconds by default)
jumpiconnumber = true, -- show different icon when jumpamount is 5, 10, or 30 jumpiconnumber = true, -- show different icon when jumpamount is 5, 10, or 30
@@ -54,18 +54,18 @@ local user_opts = {
windowcontrols = 'auto', -- whether to show window controls windowcontrols = 'auto', -- whether to show window controls
greenandgrumpy = false, -- disable santa hat greenandgrumpy = false, -- disable santa hat
language = 'eng', -- eng=English, chs=Chinese language = 'eng', -- eng=English, chs=Chinese
volumecontrol = true, -- whether to show mute button and volumne slider volumecontrol = true, -- whether to show mute button and volume slider
keyboardnavigation = false, -- enable directional keyboard navigation keyboardnavigation = false, -- enable directional keyboard navigation
chapter_fmt = "Chapter: %s", -- chapter print format for seekbar-hover. "no" to disable chapter_fmt = "Chapter: %s", -- chapter print format for seekbar-hover. "no" to disable
} }
-- Icons for jump button depending on jumpamount -- Icons for jump button depending on jumpamount
local jumpicons = { local jumpicons = {
[5] = {'\239\142\177', '\239\142\163'}, [5] = {'\239\142\177', '\239\142\163'},
[10] = {'\239\142\175', '\239\142\161'}, [10] = {'\239\142\175', '\239\142\161'},
[30] = {'\239\142\176', '\239\142\162'}, [30] = {'\239\142\176', '\239\142\162'},
default = {'\239\142\178 ', '\239\142\178'}, -- second icon is mirrored in layout() default = {'\239\142\178 ', '\239\142\178'}, -- second icon is mirrored in layout()
} }
local icons = { local icons = {
previous = '\239\142\181', previous = '\239\142\181',
@@ -79,7 +79,7 @@ local icons = {
volume_mute = '\239\142\187', volume_mute = '\239\142\187',
sub = '\239\143\147', sub = '\239\143\147',
minimize = '\239\133\172', minimize = '\239\133\172',
fullscreen = '\239\133\173', fullscreen = '\239\133\173',
info = '', info = '',
} }
@@ -724,10 +724,10 @@ function render_elements(master_ass)
if user_opts.keyboardnavigation and state.highlight_element == element.name then if user_opts.keyboardnavigation and state.highlight_element == element.name then
style_ass:append(osc_styles.elementHighlight) style_ass:append(osc_styles.elementHighlight)
end end
local elem_ass = assdraw.ass_new() local elem_ass = assdraw.ass_new()
elem_ass:merge(style_ass) elem_ass:merge(style_ass)
if not (element.type == 'button') then if not (element.type == 'button') then
elem_ass:merge(element.static_ass) elem_ass:merge(element.static_ass)
end end
@@ -743,7 +743,7 @@ function render_elements(master_ass)
local seekRanges = element.slider.seekRangesF() local seekRanges = element.slider.seekRangesF()
local rh = user_opts.seekbarhandlesize * elem_geo.h / 2 -- Handle radius local rh = user_opts.seekbarhandlesize * elem_geo.h / 2 -- Handle radius
local xp local xp
if pos then if pos then
xp = get_slider_ele_pos_for(element, pos) xp = get_slider_ele_pos_for(element, pos)
ass_draw_cir_cw(elem_ass, xp, elem_geo.h/2, rh) ass_draw_cir_cw(elem_ass, xp, elem_geo.h/2, rh)
@@ -764,7 +764,7 @@ function render_elements(master_ass)
end end
elem_ass:draw_stop() elem_ass:draw_stop()
-- add tooltip -- add tooltip
if not (element.slider.tooltipF == nil) then if not (element.slider.tooltipF == nil) then
if mouse_hit(element) then if mouse_hit(element) then
@@ -802,7 +802,7 @@ function render_elements(master_ass)
elem_ass:append(slider_lo.tooltip_style) elem_ass:append(slider_lo.tooltip_style)
ass_append_alpha(elem_ass, slider_lo.alpha, 0) ass_append_alpha(elem_ass, slider_lo.alpha, 0)
elem_ass:append(tooltiplabel) elem_ass:append(tooltiplabel)
-- thumbnail -- thumbnail
if not thumbfast.disabled then if not thumbfast.disabled then
local osd_w = mp.get_property_number("osd-width") local osd_w = mp.get_property_number("osd-width")
@@ -823,6 +823,7 @@ function render_elements(master_ass)
elem_ass:new_event() elem_ass:new_event()
elem_ass:pos(thumbX * r_w, ty - thumbMarginY - thumbfast.height * r_h) elem_ass:pos(thumbX * r_w, ty - thumbMarginY - thumbfast.height * r_h)
elem_ass:an(7)
elem_ass:append(osc_styles.Tooltip) elem_ass:append(osc_styles.Tooltip)
elem_ass:draw_start() elem_ass:draw_start()
elem_ass:rect_cw(-thumbPad * r_w, -thumbPad * r_h, (thumbfast.width + thumbPad) * r_w, (thumbfast.height + thumbPad) * r_h) elem_ass:rect_cw(-thumbPad * r_w, -thumbPad * r_h, (thumbfast.width + thumbPad) * r_w, (thumbfast.height + thumbPad) * r_h)
@@ -867,7 +868,7 @@ function render_elements(master_ass)
elseif not (element.content == nil) then elseif not (element.content == nil) then
buttontext = element.content -- text objects buttontext = element.content -- text objects
end end
buttontext = buttontext:gsub(':%((.?.?.?)%) unknown ', ':%(%1%)') --gsub('%) unknown %(\'', '') buttontext = buttontext:gsub(':%((.?.?.?)%) unknown ', ':%(%1%)') --gsub('%) unknown %(\'', '')
local maxchars = element.layout.button.maxchars local maxchars = element.layout.button.maxchars
@@ -886,7 +887,7 @@ function render_elements(master_ass)
end end
elem_ass:append(buttontext) elem_ass:append(buttontext)
-- add tooltip -- add tooltip
if not (element.tooltipF == nil) and element.enabled then if not (element.tooltipF == nil) and element.enabled then
if mouse_hit(element) then if mouse_hit(element) then
@@ -894,7 +895,7 @@ function render_elements(master_ass)
local an = 1 local an = 1
local ty = element.hitbox.y1 local ty = element.hitbox.y1
local tx = get_virt_mouse_pos() local tx = get_virt_mouse_pos()
if ty < osc_param.playresy / 2 then if ty < osc_param.playresy / 2 then
ty = element.hitbox.y2 ty = element.hitbox.y2
an = 7 an = 7
@@ -1157,7 +1158,7 @@ function window_controls()
lo.geometry = first_geo lo.geometry = first_geo
lo.style = osc_styles.WinCtrl lo.style = osc_styles.WinCtrl
lo.alpha[3] = 0 lo.alpha[3] = 0
-- Maximize: ?? /?? -- Maximize: ?? /??
ne = new_element('maximize', 'button') ne = new_element('maximize', 'button')
if state.maximized or state.fullscreen then if state.maximized or state.fullscreen then
@@ -1220,14 +1221,14 @@ layouts = function ()
lo.style = osc_styles.TransBg lo.style = osc_styles.TransBg
lo.layer = 10 lo.layer = 10
lo.alpha[3] = 0 lo.alpha[3] = 0
-- --
-- Alignment -- Alignment
-- --
local refX = osc_w / 2 local refX = osc_w / 2
local refY = posY local refY = posY
local geo local geo
-- --
-- Seekbar -- Seekbar
-- --
@@ -1248,7 +1249,7 @@ layouts = function ()
local showjump = user_opts.showjump local showjump = user_opts.showjump
local offset = showjump and 60 or 0 local offset = showjump and 60 or 0
-- --
-- Volumebar -- Volumebar
-- --
@@ -1259,7 +1260,7 @@ layouts = function ()
lo.layer = 13 lo.layer = 13
lo.style = osc_styles.VolumebarBg lo.style = osc_styles.VolumebarBg
lo = add_layout('volumebar') lo = add_layout('volumebar')
lo.geometry = {x = 155, y = refY - 40, an = 4, w = 80, h = 8} lo.geometry = {x = 155, y = refY - 40, an = 4, w = 80, h = 8}
lo.style = osc_styles.VolumebarFg lo.style = osc_styles.VolumebarFg
@@ -1282,10 +1283,10 @@ layouts = function ()
lo.geometry = {x = refX - 60, y = refY - 40 , an = 5, w = 30, h = 24} lo.geometry = {x = refX - 60, y = refY - 40 , an = 5, w = 30, h = 24}
lo.style = osc_styles.Ctrl2 lo.style = osc_styles.Ctrl2
end end
lo = add_layout('playpause') lo = add_layout('playpause')
lo.geometry = {x = refX, y = refY - 40 , an = 5, w = 45, h = 45} lo.geometry = {x = refX, y = refY - 40 , an = 5, w = 45, h = 45}
lo.style = osc_styles.Ctrl1 lo.style = osc_styles.Ctrl1
if showjump then if showjump then
lo = add_layout('jumpfrwd') lo = add_layout('jumpfrwd')
@@ -1298,7 +1299,7 @@ layouts = function ()
lo = add_layout('skipfrwd') lo = add_layout('skipfrwd')
lo.geometry = {x = refX + 60 + offset, y = refY - 40 , an = 5, w = 30, h = 24} lo.geometry = {x = refX + 60 + offset, y = refY - 40 , an = 5, w = 30, h = 24}
lo.style = osc_styles.Ctrl2 lo.style = osc_styles.Ctrl2
lo = add_layout('pl_next') lo = add_layout('pl_next')
lo.geometry = {x = refX + 120 + offset, y = refY - 40 , an = 5, w = 30, h = 24} lo.geometry = {x = refX + 120 + offset, y = refY - 40 , an = 5, w = 30, h = 24}
@@ -1308,18 +1309,18 @@ layouts = function ()
-- Time -- Time
lo = add_layout('tc_left') lo = add_layout('tc_left')
lo.geometry = {x = 25, y = refY - 84, an = 7, w = 64, h = 20} lo.geometry = {x = 25, y = refY - 84, an = 7, w = 64, h = 20}
lo.style = osc_styles.Time lo.style = osc_styles.Time
lo = add_layout('tc_right') lo = add_layout('tc_right')
lo.geometry = {x = osc_geo.w - 25 , y = refY -84, an = 9, w = 64, h = 20} lo.geometry = {x = osc_geo.w - 25 , y = refY -84, an = 9, w = 64, h = 20}
lo.style = osc_styles.Time lo.style = osc_styles.Time
lo = add_layout('cy_audio') lo = add_layout('cy_audio')
lo.geometry = {x = 37, y = refY - 40, an = 5, w = 24, h = 24} lo.geometry = {x = 37, y = refY - 40, an = 5, w = 24, h = 24}
lo.style = osc_styles.Ctrl3 lo.style = osc_styles.Ctrl3
lo.visible = (osc_param.playresx >= 540) lo.visible = (osc_param.playresx >= 540)
lo = add_layout('cy_sub') lo = add_layout('cy_sub')
lo.geometry = {x = 87, y = refY - 40, an = 5, w = 24, h = 24} lo.geometry = {x = 87, y = refY - 40, an = 5, w = 24, h = 24}
lo.style = osc_styles.Ctrl3 lo.style = osc_styles.Ctrl3
@@ -1333,13 +1334,13 @@ layouts = function ()
lo = add_layout('tog_fs') lo = add_layout('tog_fs')
lo.geometry = {x = osc_geo.w - 37, y = refY - 40, an = 5, w = 24, h = 24} lo.geometry = {x = osc_geo.w - 37, y = refY - 40, an = 5, w = 24, h = 24}
lo.style = osc_styles.Ctrl3 lo.style = osc_styles.Ctrl3
lo.visible = (osc_param.playresx >= 540) lo.visible = (osc_param.playresx >= 540)
lo = add_layout('tog_info') lo = add_layout('tog_info')
lo.geometry = {x = osc_geo.w - 87, y = refY - 40, an = 5, w = 24, h = 24} lo.geometry = {x = osc_geo.w - 87, y = refY - 40, an = 5, w = 24, h = 24}
lo.style = osc_styles.Ctrl3 lo.style = osc_styles.Ctrl3
lo.visible = (osc_param.playresx >= 600) lo.visible = (osc_param.playresx >= 600)
geo = { x = 25, y = refY - 132, an = 1, w = osc_geo.w - 50, h = 48 } geo = { x = 25, y = refY - 132, an = 1, w = osc_geo.w - 50, h = 48 }
lo = add_layout('title') lo = add_layout('title')
lo.geometry = geo lo.geometry = geo
@@ -1495,7 +1496,7 @@ function osc_init()
--function () mp.command('seek +5') end --function () mp.command('seek +5') end
function () mp.commandv('seek', jumpamount, jumpmode) end function () mp.commandv('seek', jumpamount, jumpmode) end
end end
--skipback --skipback
ne = new_element('skipback', 'button') ne = new_element('skipback', 'button')
@@ -1541,7 +1542,7 @@ function osc_init()
-- --
update_tracklist() update_tracklist()
--cy_audio --cy_audio
ne = new_element('cy_audio', 'button') ne = new_element('cy_audio', 'button')
ne.enabled = (#tracks_osc.audio > 0) ne.enabled = (#tracks_osc.audio > 0)
@@ -1574,7 +1575,7 @@ function osc_init()
function () show_message(get_tracklist('audio')) end function () show_message(get_tracklist('audio')) end
ne.eventresponder['enter'] = ne.eventresponder['enter'] =
function () set_track('audio', 1); show_message(get_tracklist('audio')) end function () set_track('audio', 1); show_message(get_tracklist('audio')) end
--cy_sub --cy_sub
ne = new_element('cy_sub', 'button') ne = new_element('cy_sub', 'button')
ne.enabled = (#tracks_osc.sub > 0) ne.enabled = (#tracks_osc.sub > 0)
@@ -1607,7 +1608,7 @@ function osc_init()
function () show_message(get_tracklist('sub')) end function () show_message(get_tracklist('sub')) end
ne.eventresponder['enter'] = ne.eventresponder['enter'] =
function () set_track('sub', 1); show_message(get_tracklist('sub')) end function () set_track('sub', 1); show_message(get_tracklist('sub')) end
-- vol_ctrl -- vol_ctrl
ne = new_element('vol_ctrl', 'button') ne = new_element('vol_ctrl', 'button')
ne.enabled = (get_track('audio')>0) ne.enabled = (get_track('audio')>0)
@@ -1625,7 +1626,7 @@ function osc_init()
function () mp.commandv("osd-auto", "add", "volume", 5) end function () mp.commandv("osd-auto", "add", "volume", 5) end
ne.eventresponder["wheel_down_press"] = ne.eventresponder["wheel_down_press"] =
function () mp.commandv("osd-auto", "add", "volume", -5) end function () mp.commandv("osd-auto", "add", "volume", -5) end
--tog_fs --tog_fs
ne = new_element('tog_fs', 'button') ne = new_element('tog_fs', 'button')
ne.content = function () ne.content = function ()
@@ -1659,7 +1660,7 @@ function osc_init()
return not (title == '') and title or ' ' return not (title == '') and title or ' '
end end
ne.visible = osc_param.playresy >= 320 and user_opts.showtitle ne.visible = osc_param.playresy >= 320 and user_opts.showtitle
--seekbar --seekbar
ne = new_element('seekbar', 'slider') ne = new_element('seekbar', 'slider')
@@ -1800,7 +1801,7 @@ function osc_init()
function () mp.commandv("osd-auto", "add", "volume", 5) end function () mp.commandv("osd-auto", "add", "volume", 5) end
ne.eventresponder["wheel_down_press"] = ne.eventresponder["wheel_down_press"] =
function () mp.commandv("osd-auto", "add", "volume", -5) end function () mp.commandv("osd-auto", "add", "volume", -5) end
-- tc_left (current pos) -- tc_left (current pos)
ne = new_element('tc_left', 'button') ne = new_element('tc_left', 'button')
ne.content = function () ne.content = function ()
@@ -1830,7 +1831,7 @@ function osc_init()
else else
return (mp.get_property_osd('duration')) return (mp.get_property_osd('duration'))
end end
end end
end end
ne.eventresponder['mbtn_left_up'] = ne.eventresponder['mbtn_left_up'] =
@@ -1849,7 +1850,7 @@ function osc_init()
end end
function shutdown() function shutdown()
end end
-- --
@@ -1866,7 +1867,7 @@ function show_osc()
state.showtime = mp.get_time() state.showtime = mp.get_time()
osc_visible(true) osc_visible(true)
if user_opts.keyboardnavigation == true then if user_opts.keyboardnavigation == true then
osc_enable_key_bindings() osc_enable_key_bindings()
end end
@@ -1905,7 +1906,7 @@ end
function pause_state(name, enabled) function pause_state(name, enabled)
state.paused = enabled state.paused = enabled
mp.add_timeout(0.1, function() state.osd:update() end) mp.add_timeout(0.1, function() state.osd:update() end)
if user_opts.showonpause then if user_opts.showonpause then
if enabled then if enabled then
state.lastvisibility = user_opts.visibility state.lastvisibility = user_opts.visibility
@@ -2246,7 +2247,7 @@ function tick()
if (not state.enabled) then return end if (not state.enabled) then return end
if (state.idle) then if (state.idle) then
-- render idle message -- render idle message
msg.trace('idle message') msg.trace('idle message')
local _, _, display_aspect = mp.get_osd_size() local _, _, display_aspect = mp.get_osd_size()
@@ -2272,7 +2273,7 @@ function tick()
ass:append(line_prefix .. line) ass:append(line_prefix .. line)
end end
end end
if user_opts.idlescreen then if user_opts.idlescreen then
ass:new_event() ass:new_event()
ass:pos(display_w / 2, icon_y + 65) ass:pos(display_w / 2, icon_y + 65)
@@ -2513,8 +2514,8 @@ function visibility_mode(mode, no_osd)
return return
end end
user_opts.visibility = mode user_opts.visibility = mode
utils.shared_script_property_set("osc-visibility", mode) mp.set_property_native("user-data/osc/visibility", user_opts.visibility)
if not no_osd and tonumber(mp.get_property('osd-level')) >= 1 then if not no_osd and tonumber(mp.get_property('osd-level')) >= 1 then
mp.osd_message('OSC visibility: ' .. mode) mp.osd_message('OSC visibility: ' .. mode)
@@ -2607,7 +2608,7 @@ end
function osc_kb_control_left() function osc_kb_control_left()
visibility_mode('always', true) visibility_mode('always', true)
local keyboard_controls = build_keyboard_controls() local keyboard_controls = build_keyboard_controls()
local active_control_name = nil local active_control_name = nil
for row_name, row_controls in pairs(keyboard_controls) do for row_name, row_controls in pairs(keyboard_controls) do
local controls = {} local controls = {}
@@ -2630,7 +2631,7 @@ function osc_kb_control_left()
if active_control_index - 1 < 0 then if active_control_index - 1 < 0 then
return return
end end
local next_control_index = active_control_index - 1 local next_control_index = active_control_index - 1
state.highlight_element = controls[next_control_index] state.highlight_element = controls[next_control_index]
return return
@@ -2642,7 +2643,7 @@ end
function osc_kb_control_right() function osc_kb_control_right()
visibility_mode('always', true) visibility_mode('always', true)
local keyboard_controls = build_keyboard_controls() local keyboard_controls = build_keyboard_controls()
local active_control_name = nil local active_control_name = nil
for row_name, row_controls in pairs(keyboard_controls) do for row_name, row_controls in pairs(keyboard_controls) do
local controls = {} local controls = {}
@@ -2665,7 +2666,7 @@ function osc_kb_control_right()
if active_control_index + 1 > #controls then if active_control_index + 1 > #controls then
return return
end end
local next_control_index = active_control_index + 1 local next_control_index = active_control_index + 1
state.highlight_element = controls[next_control_index] state.highlight_element = controls[next_control_index]
return return
@@ -2682,7 +2683,7 @@ function osc_kb_control_enter()
visibility_mode('always', true) visibility_mode('always', true)
for n = 1, #elements do for n = 1, #elements do
if elements[n].name == state.highlight_element then if elements[n].name == state.highlight_element then
local action = 'enter' local action = 'enter'
if element_has_action(elements[n], action) then if element_has_action(elements[n], action) then
elements[n].eventresponder[action](elements[n]) elements[n].eventresponder[action](elements[n])