updated reply to mpv

This commit is contained in:
2026-03-21 14:22:48 -07:00
parent 6bb3875185
commit 11384266e3
2 changed files with 118 additions and 16 deletions

View File

@@ -1625,6 +1625,20 @@ local function _queue_pipeline_in_repl(pipeline_cmd, queued_message, failure_pre
end
end
local ipc_path = trim(tostring(get_mpv_ipc_path() or ''))
if ipc_path ~= '' then
if type(queue_metadata.mpv_notify) == 'table' and trim(tostring(queue_metadata.mpv_notify.ipc_path or '')) == '' then
queue_metadata.mpv_notify.ipc_path = ipc_path
end
if type(queue_metadata.mpv_callback) ~= 'table' then
queue_metadata.mpv_callback = {
ipc_path = ipc_path,
script = mp.get_script_name(),
message = 'medeia-pipeline-event',
}
end
end
_lua_log(queue_label .. ': queueing repl cmd=' .. pipeline_cmd)
do
local queue_path, queue_err = _write_repl_queue_file_local(
@@ -1679,6 +1693,26 @@ local function _queue_pipeline_in_repl(pipeline_cmd, queued_message, failure_pre
return true
end
mp.register_script_message('medeia-pipeline-event', function(json)
local ok, payload = pcall(utils.parse_json, json)
if not ok or type(payload) ~= 'table' then
_lua_log('pipeline-event: invalid payload=' .. tostring(json or ''))
return
end
local encoded = utils.format_json(payload)
if type(encoded) == 'string' and encoded ~= '' then
pcall(mp.set_property, 'user-data/medeia-last-pipeline-event', encoded)
end
_lua_log(
'pipeline-event: phase=' .. tostring(payload.phase or '')
.. ' success=' .. tostring(payload.success)
.. ' kind=' .. tostring(payload.kind or '')
.. ' error=' .. tostring(payload.error or '')
)
end)
local function _start_screenshot_store_save(store, out_path, tags)
store = _normalize_store_name(store)
out_path = _normalize_fs_path(out_path)