kllk
This commit is contained in:
@@ -396,6 +396,9 @@ M._reset_uosc_input_state = function(reason)
|
||||
return false
|
||||
end
|
||||
pcall(mp.commandv, 'script-message-to', 'uosc', 'close-menu')
|
||||
pcall(mp.commandv, 'script-message-to', 'uosc', 'sync-cursor')
|
||||
M._disable_input_section('input_console', why .. '@immediate')
|
||||
M._disable_input_section('input_forced_console', why .. '@immediate')
|
||||
mp.add_timeout(0.05, function()
|
||||
if ensure_uosc_loaded() then
|
||||
pcall(mp.commandv, 'script-message-to', 'uosc', 'sync-cursor')
|
||||
@@ -403,6 +406,13 @@ M._reset_uosc_input_state = function(reason)
|
||||
M._disable_input_section('input_console', why .. '@sync')
|
||||
M._disable_input_section('input_forced_console', why .. '@sync')
|
||||
end)
|
||||
mp.add_timeout(0.20, function()
|
||||
if ensure_uosc_loaded() then
|
||||
pcall(mp.commandv, 'script-message-to', 'uosc', 'sync-cursor')
|
||||
end
|
||||
M._disable_input_section('input_console', why .. '@sync2')
|
||||
M._disable_input_section('input_forced_console', why .. '@sync2')
|
||||
end)
|
||||
return true
|
||||
end
|
||||
|
||||
@@ -1332,9 +1342,10 @@ local function attempt_start_pipeline_helper_async(callback)
|
||||
end
|
||||
|
||||
-- Wait for helper to become ready in background (non-blocking).
|
||||
-- 12 s gives Python time to kill a stale lock holder (PS scan + taskkill)
|
||||
-- and publish its first ready heartbeat before we give up.
|
||||
local deadline = mp.get_time() + 12.0
|
||||
-- The Python helper can spend up to 12s recovering a stale singleton lock
|
||||
-- before it even starts connecting to mpv IPC, so the Lua-side wait must be
|
||||
-- comfortably longer than that to avoid false startup failures.
|
||||
local deadline = mp.get_time() + 45.0
|
||||
local timer
|
||||
timer = mp.add_periodic_timer(0.1, function()
|
||||
if _is_pipeline_helper_ready() then
|
||||
@@ -1345,7 +1356,7 @@ local function attempt_start_pipeline_helper_async(callback)
|
||||
end
|
||||
if mp.get_time() >= deadline then
|
||||
timer:kill()
|
||||
_lua_log('attempt_start_pipeline_helper_async: timeout waiting for ready')
|
||||
_lua_log('attempt_start_pipeline_helper_async: timeout waiting for ready ' .. _helper_ready_diagnostics())
|
||||
-- Reset debounce so the next attempt is not immediate; gives the
|
||||
-- still-running Python helper time to die or acquire the lock.
|
||||
_helper_start_debounce_ts = mp.get_time()
|
||||
@@ -3795,12 +3806,11 @@ local function _sync_current_web_url_from_playback()
|
||||
end
|
||||
end
|
||||
|
||||
mp.add_hook('on_load', 50, function(hook)
|
||||
mp.add_hook('on_load', 50, function()
|
||||
local ok, err = pcall(M._apply_web_subtitle_load_defaults, 'on_load')
|
||||
if not ok then
|
||||
_lua_log('web-subtitles: on_load setup failed err=' .. tostring(err))
|
||||
end
|
||||
hook:continue()
|
||||
end)
|
||||
|
||||
local _current_store_url_status = {
|
||||
|
||||
@@ -1120,7 +1120,7 @@ def _run_op(op: str, data: Any) -> Dict[str, Any]:
|
||||
|
||||
|
||||
def _append_helper_log(text: str) -> None:
|
||||
"""Log to database instead of file. This provides unified logging with rest of system."""
|
||||
"""Log helper diagnostics to file, database, and the mpv console emitter."""
|
||||
payload = (text or "").rstrip()
|
||||
if not payload:
|
||||
return
|
||||
@@ -1129,6 +1129,12 @@ def _append_helper_log(text: str) -> None:
|
||||
if len(_HELPER_LOG_BACKLOG) > _HELPER_LOG_BACKLOG_LIMIT:
|
||||
del _HELPER_LOG_BACKLOG[:-_HELPER_LOG_BACKLOG_LIMIT]
|
||||
|
||||
try:
|
||||
with open(_helper_log_path(), "a", encoding="utf-8", errors="replace") as fh:
|
||||
fh.write(f"[{time.strftime('%Y-%m-%d %H:%M:%S')}] {payload}\n")
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
try:
|
||||
# Try database logging first (best practice: unified logging)
|
||||
from SYS.database import log_to_db
|
||||
|
||||
@@ -1113,6 +1113,13 @@ mp.register_script_message('close-menu', function(type)
|
||||
if Menu:is_open(type) then Menu:close() end
|
||||
end)
|
||||
mp.register_script_message('sync-cursor', function()
|
||||
cursor.last_events.primary_down = nil
|
||||
cursor.last_events.primary_up = nil
|
||||
cursor.last_events.secondary_down = nil
|
||||
cursor.last_events.secondary_up = nil
|
||||
cursor.last_events.primary_click = nil
|
||||
cursor.last_events.secondary_click = nil
|
||||
cursor.history:clear()
|
||||
local mouse = mp.get_property_native('mouse-pos')
|
||||
if type(mouse) == 'table' and mouse.hover and mouse.x and mouse.y then
|
||||
cursor:move(mouse.x, mouse.y)
|
||||
|
||||
Reference in New Issue
Block a user