Skip to content

Commit

Permalink
配置更新
Browse files Browse the repository at this point in the history
  • Loading branch information
dyphire committed Feb 28, 2024
1 parent 5fd662b commit 1822e12
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 9 deletions.
6 changes: 4 additions & 2 deletions mpv.conf
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,10 @@ no-title-bar # 控制是否使用窗口标题栏播放
#backdrop-type=auto # <auto|none|mica|acrylic|mica-alt> 控制背景/边框样式(仅限 Windows)
window-corners=roundsmall # <default|donotround|round|roundsmall> 控制窗口圆角的首选项。default: 让系统决定是否圆角; donotround: 禁用圆角;round: 启用圆角;roundsmall: 启用半径较小的圆角
#window-maximized=yes # 运行 MPV 自动窗口最大化(无边框界面时的最大化类似“无边窗口模式”而非“全屏”)
#background="#778899" # <格式为 (AA)RRGGBB> 更改 MPV 初启动与播放无视频轨文件时的背景颜色
#hidpi-window-scale=yes # 是否执行 HIDPI 缩放。此参数可能会影响窗口大小,禁用可以保持窗口大小不受 DPI 影响
#background=none # <none|color|默认 tiles> 如果帧具有 alpha 通道,指定使用哪种背景方式(如果有)与它混合。如果没有 alpha 通道,则不执行任何操作
## none: 不要混合帧并保持 alpha 原样;color: 将帧与背景颜色混合(由--background-color 指定,默认为黑色);tiles: 将帧与 16x16 灰色/白色瓷砖背景混合
#background-color="#778899" # <格式为 (AA)RRGGBB> 用于绘制视频未覆盖的 mpv 窗口部分的颜色
#hidpi-window-scale=yes # <yes|默认 no> 是否执行 HIDPI 缩放。此参数可能会影响窗口大小,禁用可以保持窗口大小不受 DPI 影响
# 默认值情况下初始化的视频窗口随 DPI 改变大小,例如在缩放 200% 的 4k 的显示器打开 800p 视频后自动执行 2 倍缩放变 1600p。此外还会影响其它脚本部分内容
#window-scale=1.0 # 指定窗口相对于视频原始大小的缩放倍率,默认为 1.0
# 只有在 hidpi-window-scale=no 时才能让窗口缩放为真实的 1(否则会参照系统 DPI 考量)。优先级低于 geometry 和 --autofit 参数
Expand Down
4 changes: 2 additions & 2 deletions scripts/subtitle-lines.lua
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,9 @@ local function merge_subtitle_lines(subtitles, start, stop, lines)
end
end

-- merge identical lines that are right after each other
-- merge identical lines that overlap or are right after each other
for _, subtitle in ipairs(subtitles) do
if same_time(subtitle.stop, start) then
if subtitle.stop >= start or same_time(subtitle.stop, start) then
for i = #lines, 1, -1 do
if lines[i] == subtitle.line then
table.remove(lines, i)
Expand Down
50 changes: 45 additions & 5 deletions scripts/track-list.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
--[[
* track-list.lua v.2024-01-20
* track-list.lua v.2024-02-28
*
* AUTHORS: dyphire
* License: MIT
Expand Down Expand Up @@ -61,7 +61,6 @@ opts.read_options(o)
package.path = mp.command_native({"expand-path", "~~/script-modules/?.lua;"}) .. package.path
local list = require "scroll-list"
local list_type = nil
local track_list = {}

--modifying the list settings
local original_open = list.open
Expand Down Expand Up @@ -293,17 +292,58 @@ add_keys(o.key_reload_track, 'reload_track', reloadTrack, {})
add_keys(o.key_remove_track, 'remove_track', removeTrack, {})
add_keys(o.key_close_browser, 'close_browser', function() list:close() end, {})

local function toggleListDelayed(type)
list_type = type
function list:open()
if list_type == "video" then
video_menu = true
audio_menu = false
sub_menu = false
sub2_menu = false
elseif list_type == "audio" then
video_menu = false
audio_menu = true
sub_menu = false
sub2_menu = false
elseif list_type == "sub" then
video_menu = false
audio_menu = false
sub_menu = true
sub2_menu = false
elseif list_type == "sub2" then
video_menu = false
audio_menu = false
sub_menu = false
sub2_menu = true
end
original_open(self)
end

local function toggleListDelayed()
mp.add_timeout(0.1, function()
list:toggle()
end)
end

local function toggleList(type)
list_type = type
if list_type == "video" then
if video_menu then video_menu = false
else toggleListDelayed() end
elseif list_type == "audio" then
if audio_menu then audio_menu = false
else toggleListDelayed() end
elseif list_type == "sub" then
if sub_menu then sub_menu = false
else toggleListDelayed() end
elseif list_type == "sub2" then
if sub2_menu then sub2_menu = false
else toggleListDelayed() end
end
end

local function openTrackList(title, type, prop)
list:close()
updateTrackList(title, type, prop)
toggleListDelayed(type)
toggleList(type)
end

mp.register_script_message("toggle-vidtrack-browser", function()
Expand Down

0 comments on commit 1822e12

Please sign in to comment.