f
This commit is contained in:
511
MPV/LUA/main.lua
511
MPV/LUA/main.lua
@@ -463,6 +463,193 @@ local function ensure_mpv_ipc_server()
|
||||
return (now and now ~= '') and true or false
|
||||
end
|
||||
|
||||
local function ensure_pipeline_helper_running()
|
||||
-- IMPORTANT: do NOT spawn Python from inside mpv.
|
||||
-- The Python side (MPV.mpv_ipc) starts pipeline_helper.py using Windows
|
||||
-- no-console flags; spawning here can flash a console window.
|
||||
return _is_pipeline_helper_ready() and true or false
|
||||
end
|
||||
|
||||
local _ipc_async_busy = false
|
||||
local _ipc_async_queue = {}
|
||||
|
||||
local function _run_helper_request_async(req, timeout_seconds, cb)
|
||||
cb = cb or function() end
|
||||
|
||||
if _ipc_async_busy then
|
||||
_ipc_async_queue[#_ipc_async_queue + 1] = { req = req, timeout = timeout_seconds, cb = cb }
|
||||
return
|
||||
end
|
||||
_ipc_async_busy = true
|
||||
|
||||
local function done(resp, err)
|
||||
_ipc_async_busy = false
|
||||
cb(resp, err)
|
||||
|
||||
if #_ipc_async_queue > 0 then
|
||||
local next_job = table.remove(_ipc_async_queue, 1)
|
||||
-- Schedule next job slightly later to let mpv deliver any pending events.
|
||||
mp.add_timeout(0.01, function()
|
||||
_run_helper_request_async(next_job.req, next_job.timeout, next_job.cb)
|
||||
end)
|
||||
end
|
||||
end
|
||||
|
||||
if type(req) ~= 'table' then
|
||||
done(nil, 'invalid request')
|
||||
return
|
||||
end
|
||||
|
||||
ensure_mpv_ipc_server()
|
||||
if not ensure_pipeline_helper_running() then
|
||||
done(nil, 'helper not running')
|
||||
return
|
||||
end
|
||||
|
||||
-- Assign id.
|
||||
local id = tostring(req.id or '')
|
||||
if id == '' then
|
||||
id = tostring(math.floor(mp.get_time() * 1000)) .. '-' .. tostring(math.random(100000, 999999))
|
||||
req.id = id
|
||||
end
|
||||
|
||||
local label = ''
|
||||
if req.op then
|
||||
label = 'op=' .. tostring(req.op)
|
||||
elseif req.pipeline then
|
||||
label = 'cmd=' .. tostring(req.pipeline)
|
||||
else
|
||||
label = '(unknown)'
|
||||
end
|
||||
|
||||
-- Wait for helper READY without blocking the UI.
|
||||
local ready_deadline = mp.get_time() + 3.0
|
||||
local ready_timer
|
||||
ready_timer = mp.add_periodic_timer(0.05, function()
|
||||
if _is_pipeline_helper_ready() then
|
||||
ready_timer:kill()
|
||||
|
||||
_lua_log('ipc-async: send request id=' .. tostring(id) .. ' ' .. label)
|
||||
local req_json = utils.format_json(req)
|
||||
_last_ipc_last_req_json = req_json
|
||||
|
||||
mp.set_property(PIPELINE_RESP_PROP, '')
|
||||
mp.set_property(PIPELINE_REQ_PROP, req_json)
|
||||
|
||||
local deadline = mp.get_time() + (timeout_seconds or 5)
|
||||
local poll_timer
|
||||
poll_timer = mp.add_periodic_timer(0.05, function()
|
||||
if mp.get_time() >= deadline then
|
||||
poll_timer:kill()
|
||||
done(nil, 'timeout waiting response (' .. label .. ')')
|
||||
return
|
||||
end
|
||||
|
||||
local resp_json = mp.get_property(PIPELINE_RESP_PROP)
|
||||
if resp_json and resp_json ~= '' then
|
||||
_last_ipc_last_resp_json = resp_json
|
||||
local ok, resp = pcall(utils.parse_json, resp_json)
|
||||
if ok and resp and resp.id == id then
|
||||
poll_timer:kill()
|
||||
_lua_log('ipc-async: got response id=' .. tostring(id) .. ' success=' .. tostring(resp.success))
|
||||
done(resp, nil)
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
return
|
||||
end
|
||||
|
||||
if mp.get_time() >= ready_deadline then
|
||||
ready_timer:kill()
|
||||
done(nil, 'helper not ready')
|
||||
return
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
local function _run_helper_request_response(req, timeout_seconds)
|
||||
_last_ipc_error = ''
|
||||
if not ensure_pipeline_helper_running() then
|
||||
local rv = tostring(mp.get_property(PIPELINE_READY_PROP) or mp.get_property_native(PIPELINE_READY_PROP) or '')
|
||||
_lua_log('ipc: helper not ready (ready=' .. rv .. '); attempting request anyway')
|
||||
_last_ipc_error = 'helper not ready'
|
||||
end
|
||||
|
||||
do
|
||||
-- Best-effort wait for heartbeat, but do not hard-fail the request.
|
||||
local deadline = mp.get_time() + 1.5
|
||||
while mp.get_time() < deadline do
|
||||
if _is_pipeline_helper_ready() then
|
||||
break
|
||||
end
|
||||
mp.wait_event(0.05)
|
||||
end
|
||||
if not _is_pipeline_helper_ready() then
|
||||
local rv = tostring(mp.get_property(PIPELINE_READY_PROP) or mp.get_property_native(PIPELINE_READY_PROP) or '')
|
||||
_lua_log('ipc: proceeding without helper heartbeat; ready=' .. rv)
|
||||
_last_ipc_error = 'helper heartbeat missing (ready=' .. rv .. ')'
|
||||
end
|
||||
end
|
||||
|
||||
if type(req) ~= 'table' then
|
||||
return nil
|
||||
end
|
||||
|
||||
local id = tostring(req.id or '')
|
||||
if id == '' then
|
||||
id = tostring(math.floor(mp.get_time() * 1000)) .. '-' .. tostring(math.random(100000, 999999))
|
||||
req.id = id
|
||||
end
|
||||
|
||||
local label = ''
|
||||
if req.op then
|
||||
label = 'op=' .. tostring(req.op)
|
||||
elseif req.pipeline then
|
||||
label = 'cmd=' .. tostring(req.pipeline)
|
||||
else
|
||||
label = '(unknown)'
|
||||
end
|
||||
_lua_log('ipc: send request id=' .. tostring(id) .. ' ' .. label)
|
||||
|
||||
local req_json = utils.format_json(req)
|
||||
_last_ipc_last_req_json = req_json
|
||||
mp.set_property(PIPELINE_RESP_PROP, '')
|
||||
mp.set_property(PIPELINE_REQ_PROP, req_json)
|
||||
-- Read-back for debugging: confirms MPV accepted the property write.
|
||||
local echoed = mp.get_property(PIPELINE_REQ_PROP) or ''
|
||||
if echoed == '' then
|
||||
_lua_log('ipc: WARNING request property echoed empty after set')
|
||||
end
|
||||
|
||||
local deadline = mp.get_time() + (timeout_seconds or 5)
|
||||
while mp.get_time() < deadline do
|
||||
local resp_json = mp.get_property(PIPELINE_RESP_PROP)
|
||||
if resp_json and resp_json ~= '' then
|
||||
_last_ipc_last_resp_json = resp_json
|
||||
local ok, resp = pcall(utils.parse_json, resp_json)
|
||||
if ok and resp and resp.id == id then
|
||||
_lua_log('ipc: got response id=' .. tostring(id) .. ' success=' .. tostring(resp.success))
|
||||
return resp
|
||||
end
|
||||
end
|
||||
mp.wait_event(0.05)
|
||||
end
|
||||
|
||||
_lua_log('ipc: timeout waiting response; ' .. label)
|
||||
_last_ipc_error = 'timeout waiting response (' .. label .. ')'
|
||||
return nil
|
||||
end
|
||||
|
||||
-- IPC helper: return the whole response object (stdout/stderr/error/table)
|
||||
local function run_pipeline_via_ipc_response(pipeline_cmd, seeds, timeout_seconds)
|
||||
local req = { pipeline = pipeline_cmd }
|
||||
if seeds then
|
||||
req.seeds = seeds
|
||||
end
|
||||
return _run_helper_request_response(req, timeout_seconds)
|
||||
end
|
||||
|
||||
local function quote_pipeline_arg(s)
|
||||
-- Ensure URLs with special characters (e.g. &, #) survive pipeline parsing.
|
||||
s = tostring(s or '')
|
||||
@@ -758,11 +945,25 @@ local function _capture_screenshot()
|
||||
local temp_dir = mp.get_property('user-data/medeia-config-temp') or os.getenv('TEMP') or os.getenv('TMP') or '/tmp'
|
||||
local out_path = utils.join_path(temp_dir, filename)
|
||||
|
||||
local ok = pcall(function()
|
||||
mp.commandv('screenshot-to-file', out_path, 'video')
|
||||
end)
|
||||
local function do_screenshot(mode)
|
||||
mode = mode or 'video'
|
||||
local ok, err = pcall(function()
|
||||
return mp.commandv('screenshot-to-file', out_path, mode)
|
||||
end)
|
||||
return ok, err
|
||||
end
|
||||
|
||||
-- Try 'video' first (no OSD). If that fails (e.g. audio mode without video/art),
|
||||
-- try 'window' as fallback.
|
||||
local ok = do_screenshot('video')
|
||||
if not ok then
|
||||
mp.osd_message('Screenshot failed', 2)
|
||||
_lua_log('screenshot: video-mode failed; trying window-mode')
|
||||
ok = do_screenshot('window')
|
||||
end
|
||||
|
||||
if not ok then
|
||||
_lua_log('screenshot: BOTH video and window modes FAILED')
|
||||
mp.osd_message('Screenshot failed (no frames)', 2)
|
||||
return
|
||||
end
|
||||
|
||||
@@ -775,30 +976,20 @@ local function _capture_screenshot()
|
||||
mp.osd_message('Select a store first (Store button)', 2)
|
||||
return
|
||||
end
|
||||
|
||||
local python_exe = _resolve_python_exe(true)
|
||||
if not python_exe or python_exe == '' then
|
||||
mp.osd_message('Screenshot saved; Python not found', 3)
|
||||
return
|
||||
end
|
||||
|
||||
local start_dir = mp.get_script_directory() or ''
|
||||
local cli_py = find_file_upwards(start_dir, 'CLI.py', 8)
|
||||
if not cli_py or cli_py == '' or not utils.file_info(cli_py) then
|
||||
mp.osd_message('Screenshot saved; CLI.py not found', 3)
|
||||
return
|
||||
end
|
||||
|
||||
local res = utils.subprocess({
|
||||
args = { python_exe, cli_py, 'add-file', '-store', selected_store, '-path', out_path },
|
||||
cancellable = false,
|
||||
})
|
||||
|
||||
if res and res.status == 0 then
|
||||
|
||||
mp.osd_message('Saving screenshot...', 1)
|
||||
|
||||
-- optimization: use persistent pipeline helper instead of spawning new python process
|
||||
-- escape paths for command line
|
||||
local cmd = 'add-file -store "' .. selected_store .. '" -path "' .. out_path .. '"'
|
||||
|
||||
local resp = run_pipeline_via_ipc_response(cmd, nil, 10)
|
||||
|
||||
if resp and resp.success then
|
||||
mp.osd_message('Screenshot saved to store: ' .. selected_store, 3)
|
||||
else
|
||||
local stderr = (res and res.stderr) or 'unknown error'
|
||||
mp.osd_message('Screenshot upload failed: ' .. tostring(stderr), 5)
|
||||
local err = (resp and resp.error) or (resp and resp.stderr) or 'IPC error'
|
||||
mp.osd_message('Screenshot upload failed: ' .. tostring(err), 5)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1054,91 +1245,6 @@ local function _pick_folder_windows()
|
||||
return nil
|
||||
end
|
||||
|
||||
-- Forward declaration: used by run_pipeline_via_ipc_response before definition.
|
||||
local ensure_pipeline_helper_running
|
||||
|
||||
local function _run_helper_request_response(req, timeout_seconds)
|
||||
_last_ipc_error = ''
|
||||
if not ensure_pipeline_helper_running() then
|
||||
local rv = tostring(mp.get_property(PIPELINE_READY_PROP) or mp.get_property_native(PIPELINE_READY_PROP) or '')
|
||||
_lua_log('ipc: helper not ready (ready=' .. rv .. '); attempting request anyway')
|
||||
_last_ipc_error = 'helper not ready'
|
||||
end
|
||||
|
||||
do
|
||||
-- Best-effort wait for heartbeat, but do not hard-fail the request.
|
||||
local deadline = mp.get_time() + 1.5
|
||||
while mp.get_time() < deadline do
|
||||
if _is_pipeline_helper_ready() then
|
||||
break
|
||||
end
|
||||
mp.wait_event(0.05)
|
||||
end
|
||||
if not _is_pipeline_helper_ready() then
|
||||
local rv = tostring(mp.get_property(PIPELINE_READY_PROP) or mp.get_property_native(PIPELINE_READY_PROP) or '')
|
||||
_lua_log('ipc: proceeding without helper heartbeat; ready=' .. rv)
|
||||
_last_ipc_error = 'helper heartbeat missing (ready=' .. rv .. ')'
|
||||
end
|
||||
end
|
||||
|
||||
if type(req) ~= 'table' then
|
||||
return nil
|
||||
end
|
||||
|
||||
local id = tostring(req.id or '')
|
||||
if id == '' then
|
||||
id = tostring(math.floor(mp.get_time() * 1000)) .. '-' .. tostring(math.random(100000, 999999))
|
||||
req.id = id
|
||||
end
|
||||
|
||||
local label = ''
|
||||
if req.op then
|
||||
label = 'op=' .. tostring(req.op)
|
||||
elseif req.pipeline then
|
||||
label = 'cmd=' .. tostring(req.pipeline)
|
||||
else
|
||||
label = '(unknown)'
|
||||
end
|
||||
_lua_log('ipc: send request id=' .. tostring(id) .. ' ' .. label)
|
||||
|
||||
local req_json = utils.format_json(req)
|
||||
_last_ipc_last_req_json = req_json
|
||||
mp.set_property(PIPELINE_RESP_PROP, '')
|
||||
mp.set_property(PIPELINE_REQ_PROP, req_json)
|
||||
-- Read-back for debugging: confirms MPV accepted the property write.
|
||||
local echoed = mp.get_property(PIPELINE_REQ_PROP) or ''
|
||||
if echoed == '' then
|
||||
_lua_log('ipc: WARNING request property echoed empty after set')
|
||||
end
|
||||
|
||||
local deadline = mp.get_time() + (timeout_seconds or 5)
|
||||
while mp.get_time() < deadline do
|
||||
local resp_json = mp.get_property(PIPELINE_RESP_PROP)
|
||||
if resp_json and resp_json ~= '' then
|
||||
_last_ipc_last_resp_json = resp_json
|
||||
local ok, resp = pcall(utils.parse_json, resp_json)
|
||||
if ok and resp and resp.id == id then
|
||||
_lua_log('ipc: got response id=' .. tostring(id) .. ' success=' .. tostring(resp.success))
|
||||
return resp
|
||||
end
|
||||
end
|
||||
mp.wait_event(0.05)
|
||||
end
|
||||
|
||||
_lua_log('ipc: timeout waiting response; ' .. label)
|
||||
_last_ipc_error = 'timeout waiting response (' .. label .. ')'
|
||||
return nil
|
||||
end
|
||||
|
||||
-- IPC helper: return the whole response object (stdout/stderr/error/table)
|
||||
local function run_pipeline_via_ipc_response(pipeline_cmd, seeds, timeout_seconds)
|
||||
local req = { pipeline = pipeline_cmd }
|
||||
if seeds then
|
||||
req.seeds = seeds
|
||||
end
|
||||
return _run_helper_request_response(req, timeout_seconds)
|
||||
end
|
||||
|
||||
local function _store_names_key(names)
|
||||
if type(names) ~= 'table' or #names == 0 then
|
||||
return ''
|
||||
@@ -1438,101 +1544,6 @@ local function _get_cached_formats_table(url)
|
||||
return nil
|
||||
end
|
||||
|
||||
local function _run_helper_request_async(req, timeout_seconds, cb)
|
||||
cb = cb or function() end
|
||||
|
||||
if _ipc_async_busy then
|
||||
_ipc_async_queue[#_ipc_async_queue + 1] = { req = req, timeout = timeout_seconds, cb = cb }
|
||||
return
|
||||
end
|
||||
_ipc_async_busy = true
|
||||
|
||||
local function done(resp, err)
|
||||
_ipc_async_busy = false
|
||||
cb(resp, err)
|
||||
|
||||
if #_ipc_async_queue > 0 then
|
||||
local next_job = table.remove(_ipc_async_queue, 1)
|
||||
-- Schedule next job slightly later to let mpv deliver any pending events.
|
||||
mp.add_timeout(0.01, function()
|
||||
_run_helper_request_async(next_job.req, next_job.timeout, next_job.cb)
|
||||
end)
|
||||
end
|
||||
end
|
||||
|
||||
if type(req) ~= 'table' then
|
||||
done(nil, 'invalid request')
|
||||
return
|
||||
end
|
||||
|
||||
ensure_mpv_ipc_server()
|
||||
if not ensure_pipeline_helper_running() then
|
||||
done(nil, 'helper not running')
|
||||
return
|
||||
end
|
||||
|
||||
-- Assign id.
|
||||
local id = tostring(req.id or '')
|
||||
if id == '' then
|
||||
id = tostring(math.floor(mp.get_time() * 1000)) .. '-' .. tostring(math.random(100000, 999999))
|
||||
req.id = id
|
||||
end
|
||||
|
||||
local label = ''
|
||||
if req.op then
|
||||
label = 'op=' .. tostring(req.op)
|
||||
elseif req.pipeline then
|
||||
label = 'cmd=' .. tostring(req.pipeline)
|
||||
else
|
||||
label = '(unknown)'
|
||||
end
|
||||
|
||||
-- Wait for helper READY without blocking the UI.
|
||||
local ready_deadline = mp.get_time() + 3.0
|
||||
local ready_timer
|
||||
ready_timer = mp.add_periodic_timer(0.05, function()
|
||||
if _is_pipeline_helper_ready() then
|
||||
ready_timer:kill()
|
||||
|
||||
_lua_log('ipc-async: send request id=' .. tostring(id) .. ' ' .. label)
|
||||
local req_json = utils.format_json(req)
|
||||
_last_ipc_last_req_json = req_json
|
||||
|
||||
mp.set_property(PIPELINE_RESP_PROP, '')
|
||||
mp.set_property(PIPELINE_REQ_PROP, req_json)
|
||||
|
||||
local deadline = mp.get_time() + (timeout_seconds or 5)
|
||||
local poll_timer
|
||||
poll_timer = mp.add_periodic_timer(0.05, function()
|
||||
if mp.get_time() >= deadline then
|
||||
poll_timer:kill()
|
||||
done(nil, 'timeout waiting response (' .. label .. ')')
|
||||
return
|
||||
end
|
||||
|
||||
local resp_json = mp.get_property(PIPELINE_RESP_PROP)
|
||||
if resp_json and resp_json ~= '' then
|
||||
_last_ipc_last_resp_json = resp_json
|
||||
local ok, resp = pcall(utils.parse_json, resp_json)
|
||||
if ok and resp and resp.id == id then
|
||||
poll_timer:kill()
|
||||
_lua_log('ipc-async: got response id=' .. tostring(id) .. ' success=' .. tostring(resp.success))
|
||||
done(resp, nil)
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
return
|
||||
end
|
||||
|
||||
if mp.get_time() >= ready_deadline then
|
||||
ready_timer:kill()
|
||||
done(nil, 'helper not ready')
|
||||
return
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
function FileState:fetch_formats(cb)
|
||||
local url = tostring(self.url or '')
|
||||
if url == '' or not _is_http_url(url) then
|
||||
@@ -2077,13 +2088,6 @@ mp.register_script_message('medios-download-pick-path', function()
|
||||
_pending_download = nil
|
||||
end)
|
||||
|
||||
ensure_pipeline_helper_running = function()
|
||||
-- IMPORTANT: do NOT spawn Python from inside mpv.
|
||||
-- The Python side (MPV.mpv_ipc) starts pipeline_helper.py using Windows
|
||||
-- no-console flags; spawning here can flash a console window.
|
||||
return _is_pipeline_helper_ready() and true or false
|
||||
end
|
||||
|
||||
local function run_pipeline_via_ipc(pipeline_cmd, seeds, timeout_seconds)
|
||||
if not ensure_pipeline_helper_running() then
|
||||
return nil
|
||||
@@ -2177,72 +2181,8 @@ if not opts.cli_path then
|
||||
opts.cli_path = find_file_upwards(script_dir, "CLI.py", 6) or "CLI.py"
|
||||
end
|
||||
|
||||
-- Clean API wrapper for executing Python functions from Lua
|
||||
local function _call_mpv_api(request)
|
||||
-- Call the MPV Lua API (mpv_lua_api.py) with a JSON request.
|
||||
-- Returns: JSON-decoded response object with {success, stdout, stderr, error, ...}
|
||||
local request_json = utils.format_json(request)
|
||||
|
||||
-- Try to get log file path; skip if not available
|
||||
local log_file = ''
|
||||
local home = os.getenv('USERPROFILE') or os.getenv('HOME') or ''
|
||||
if home ~= '' then
|
||||
log_file = home .. '/../../medios/Medios-Macina/Log/medeia-mpv-helper.log'
|
||||
end
|
||||
|
||||
_lua_log('api: calling mpv_lua_api cmd=' .. tostring(request.cmd))
|
||||
|
||||
local python_exe = _resolve_python_exe(true)
|
||||
if not python_exe or python_exe == '' then
|
||||
_lua_log('api: FAILED - no python exe')
|
||||
return { success = false, error = 'could not find Python' }
|
||||
end
|
||||
|
||||
-- Try to locate API script
|
||||
local api_script = nil
|
||||
local script_dir = mp.get_script_directory()
|
||||
if script_dir and script_dir ~= '' then
|
||||
api_script = script_dir .. '/mpv_lua_api.py'
|
||||
if not utils.file_info(api_script) then
|
||||
api_script = script_dir .. '/../mpv_lua_api.py'
|
||||
end
|
||||
end
|
||||
|
||||
if not api_script or api_script == '' or not utils.file_info(api_script) then
|
||||
-- Fallback: try absolute path
|
||||
local repo_root = os.getenv('USERPROFILE')
|
||||
if repo_root then
|
||||
api_script = repo_root .. '/../../../medios/Medios-Macina/MPV/mpv_lua_api.py'
|
||||
end
|
||||
end
|
||||
|
||||
if not api_script or api_script == '' then
|
||||
_lua_log('api: FAILED - could not locate mpv_lua_api.py')
|
||||
return { success = false, error = 'could not locate mpv_lua_api.py' }
|
||||
end
|
||||
|
||||
_lua_log('api: python=' .. tostring(python_exe) .. ' script=' .. tostring(api_script))
|
||||
|
||||
local res = utils.subprocess({
|
||||
args = { python_exe, api_script, request_json, log_file },
|
||||
cancellable = false,
|
||||
})
|
||||
|
||||
if res and res.status == 0 and res.stdout then
|
||||
local ok, response = pcall(utils.parse_json, res.stdout)
|
||||
if ok and response then
|
||||
_lua_log('api: response success=' .. tostring(response.success))
|
||||
return response
|
||||
else
|
||||
_lua_log('api: failed to parse response: ' .. tostring(res.stdout))
|
||||
return { success = false, error = 'malformed response', stdout = res.stdout }
|
||||
end
|
||||
else
|
||||
local stderr = res and res.stderr or 'unknown error'
|
||||
_lua_log('api: subprocess failed status=' .. tostring(res and res.status or 'nil') .. ' stderr=' .. stderr)
|
||||
return { success = false, error = stderr }
|
||||
end
|
||||
end
|
||||
-- Ref: mpv_lua_api.py was removed in favor of pipeline_helper (run_pipeline_via_ipc_response).
|
||||
-- This placeholder comment ensures we don't have code shifting issues.
|
||||
|
||||
-- Run a Medeia pipeline command via the Python pipeline helper (IPC request/response).
|
||||
-- Calls the callback with stdout on success or error message on failure.
|
||||
@@ -2551,13 +2491,14 @@ local function _start_trim_with_range(range)
|
||||
end
|
||||
|
||||
_lua_log('trim: final upload_cmd=' .. pipeline_cmd)
|
||||
_lua_log('trim: === CALLING API FOR UPLOAD ===')
|
||||
_lua_log('trim: === CALLING PIPELINE HELPER FOR UPLOAD ===')
|
||||
|
||||
-- Call the API to handle metadata/storage
|
||||
local response = _call_mpv_api({
|
||||
cmd = 'execute_pipeline',
|
||||
pipeline = pipeline_cmd,
|
||||
})
|
||||
-- Optimization: use persistent pipeline helper
|
||||
local response = run_pipeline_via_ipc_response(pipeline_cmd, nil, 60)
|
||||
|
||||
if not response then
|
||||
response = { success = false, error = "Timeout or IPC error" }
|
||||
end
|
||||
|
||||
_lua_log('trim: api response success=' .. tostring(response.success))
|
||||
_lua_log('trim: api response error=' .. tostring(response.error or 'nil'))
|
||||
|
||||
Reference in New Issue
Block a user