Fix Windows mpv logging and add log export (#88)

This commit is contained in:
2026-05-26 00:31:38 -07:00
committed by GitHub
parent 43ebc7d371
commit 11c196821d
150 changed files with 2748 additions and 582 deletions
+3 -1
View File
@@ -126,7 +126,9 @@ function M.create(ctx)
subminer_log(
"info",
"lifecycle",
"Skipping auto-start: input-ipc-server does not match configured socket_path"
"Skipping auto-start: input-ipc-server does not match configured socket_path ("
.. process.describe_mpv_ipc_socket_match(opts.socket_path)
.. ")"
)
schedule_aniskip_fetch("file-loaded", 0)
return
+1 -1
View File
@@ -21,7 +21,7 @@ function M.create(ctx)
end
local function should_log(level)
local current = normalize_log_level(opts.log_level)
local current = normalize_log_level(os.getenv("SUBMINER_LOG_LEVEL"))
local target = normalize_log_level(level)
return LOG_LEVEL_PRIORITY[target] >= LOG_LEVEL_PRIORITY[current]
end
+20 -3
View File
@@ -172,13 +172,29 @@ function M.create(ctx)
return trimmed
end
local function has_matching_mpv_ipc_socket(target_socket_path)
local function get_mpv_ipc_socket_match(target_socket_path)
local expected_socket = normalize_socket_path(target_socket_path or opts.socket_path)
local active_socket = normalize_socket_path(mp.get_property("input-ipc-server"))
return {
expected_socket = expected_socket,
active_socket = active_socket,
matching = expected_socket ~= nil and active_socket ~= nil and expected_socket == active_socket,
}
end
local function has_matching_mpv_ipc_socket(target_socket_path)
local match = get_mpv_ipc_socket_match(target_socket_path)
return match.matching
end
local function describe_mpv_ipc_socket_match(target_socket_path)
local match = get_mpv_ipc_socket_match(target_socket_path)
local expected_socket = match.expected_socket or "<empty>"
local active_socket = match.active_socket or "<empty>"
if expected_socket == nil or active_socket == nil then
return false
return "expected=" .. expected_socket .. "; active=" .. active_socket .. "; matching=no"
end
return expected_socket == active_socket
return "expected=" .. expected_socket .. "; active=" .. active_socket .. "; matching=" .. (match.matching and "yes" or "no")
end
local function resolve_backend(override_backend)
@@ -822,6 +838,7 @@ function M.create(ctx)
return {
build_command_args = build_command_args,
describe_mpv_ipc_socket_match = describe_mpv_ipc_socket_match,
has_matching_mpv_ipc_socket = has_matching_mpv_ipc_socket,
run_control_command_async = run_control_command_async,
record_visible_overlay_visibility = record_visible_overlay_visibility,
+34 -6
View File
@@ -182,7 +182,35 @@ function M.create(ctx)
return bindings
end
local function build_cli_args(action_id, payload)
local function normalize_cli_args(cli_args)
if type(cli_args) ~= "table" then
return nil
end
local normalized = {}
for _, arg in ipairs(cli_args) do
if type(arg) ~= "string" and type(arg) ~= "number" then
return nil
end
local value = tostring(arg)
if value == "" then
return nil
end
normalized[#normalized + 1] = value
end
if #normalized == 0 then
return nil
end
return normalized
end
local function build_cli_args(action_id, payload, artifact_cli_args)
local cli_args = normalize_cli_args(artifact_cli_args)
if cli_args then
return cli_args
end
if action_id == "toggleVisibleOverlay" then
return { "--toggle-visible-overlay" }
elseif action_id == "toggleStatsOverlay" then
@@ -223,8 +251,8 @@ function M.create(ctx)
return { "--open-youtube-picker" }
elseif action_id == "openSessionHelp" then
return { "--open-session-help" }
elseif action_id == "openCharacterDictionary" then
return { "--open-character-dictionary" }
elseif action_id == "openCharacterDictionaryManager" then
return { "--session-action", '{"actionId":"openCharacterDictionaryManager"}' }
elseif action_id == "openControllerSelect" then
return { "--open-controller-select" }
elseif action_id == "openControllerDebug" then
@@ -251,13 +279,13 @@ function M.create(ctx)
return nil
end
local function invoke_cli_action(action_id, payload)
local function invoke_cli_action(action_id, payload, artifact_cli_args)
if not process.check_binary_available() then
show_osd("Error: binary not found")
return
end
local cli_args = build_cli_args(action_id, payload)
local cli_args = build_cli_args(action_id, payload, artifact_cli_args)
if not cli_args then
subminer_log("warn", "session-bindings", "No CLI mapping for action: " .. tostring(action_id))
return
@@ -312,7 +340,7 @@ function M.create(ctx)
return
end
invoke_cli_action(binding.actionId, binding.payload)
invoke_cli_action(binding.actionId, binding.payload, binding.cliArgs)
end
local function load_artifact()