Fix Windows mpv shortcut launch and subtitle dedupe

This commit is contained in:
2026-04-02 23:28:43 -07:00
parent 640c8acd7c
commit 85e3aa4c6b
15 changed files with 480 additions and 22 deletions

View File

@@ -178,6 +178,12 @@ local function run_plugin_scenario(config)
value = value,
}
end
function mp.set_property(name, value)
recorded.property_sets[#recorded.property_sets + 1] = {
name = name,
value = value,
}
end
function mp.get_script_name()
return "subminer"
end
@@ -531,6 +537,38 @@ do
)
end
do
local recorded, err = run_plugin_scenario({
process_list = "",
option_overrides = {
binary_path = binary_path,
auto_start = "yes",
auto_start_visible_overlay = "yes",
auto_start_pause_until_ready = "no",
socket_path = "/tmp/subminer-socket",
},
input_ipc_server = "/tmp/subminer-socket",
media_title = "Random Movie",
files = {
[binary_path] = true,
},
})
assert_true(recorded ~= nil, "plugin failed to load for subtitle rearm scenario: " .. tostring(err))
fire_event(recorded, "file-loaded")
assert_true(
has_property_set(recorded.property_sets, "sub-auto", "fuzzy"),
"managed file-loaded should rearm sub-auto for idle mpv sessions"
)
assert_true(
has_property_set(recorded.property_sets, "sid", "auto"),
"managed file-loaded should rearm primary subtitle selection for idle mpv sessions"
)
assert_true(
has_property_set(recorded.property_sets, "secondary-sid", "auto"),
"managed file-loaded should rearm secondary subtitle selection for idle mpv sessions"
)
end
do
local recorded, err = run_plugin_scenario({
process_list = "",
@@ -1037,6 +1075,10 @@ do
start_call == nil,
"auto-start should be skipped when mpv input-ipc-server does not match configured socket_path"
)
assert_true(
not has_property_set(recorded.property_sets, "sid", "auto"),
"subtitle rearm should not run when mpv input-ipc-server does not match configured socket_path"
)
assert_true(
not has_property_set(recorded.property_sets, "pause", true),
"pause-until-ready gate should not arm when socket_path does not match"