This commit is contained in:
2026-03-21 23:49:32 -07:00
parent f8c98b39bd
commit 3e922f7b3a
3 changed files with 65 additions and 29 deletions

View File

@@ -494,7 +494,7 @@
"mediafire\\.com/(\\?|download/|file/|download\\.php\\?)([0-9a-z]{15})"
],
"regexp": "mediafire\\.com/(\\?|download/|file/|download\\.php\\?)([0-9a-z]{15})",
"status": false
"status": true
},
"mixdrop": {
"name": "mixdrop",

View File

@@ -4,7 +4,7 @@ local msg = require 'mp.msg'
local M = {}
local MEDEIA_LUA_VERSION = '2026-03-21.3'
local MEDEIA_LUA_VERSION = '2026-03-21.4'
-- Expose a tiny breadcrumb for debugging which script version is loaded.
pcall(mp.set_property, 'user-data/medeia-lua-version', MEDEIA_LUA_VERSION)
@@ -880,7 +880,7 @@ local function _is_pipeline_helper_ready()
helper_version = mp.get_property_native('user-data/medeia-pipeline-helper-version')
end
helper_version = tostring(helper_version or '')
if helper_version ~= '2026-03-22.4' then
if helper_version ~= '2026-03-22.5' then
return false
end
@@ -947,7 +947,7 @@ local function _helper_ready_diagnostics()
end
return 'ready=' .. tostring(ready or '')
.. ' helper_version=' .. tostring(helper_version or '')
.. ' required_version=2026-03-22.4'
.. ' required_version=2026-03-22.5'
.. ' last_value=' .. tostring(_helper_ready_last_value or '')
.. ' last_seen_age=' .. tostring(age)
end

View File

@@ -20,7 +20,7 @@ This helper is intentionally minimal: one request at a time, last-write-wins.
from __future__ import annotations
MEDEIA_MPV_HELPER_VERSION = "2026-03-22.4"
MEDEIA_MPV_HELPER_VERSION = "2026-03-22.5"
import argparse
import json
@@ -1322,6 +1322,12 @@ def main(argv: Optional[list[str]] = None) -> int:
# path used by this helper (which comes from the running MPV instance).
os.environ["MEDEIA_MPV_IPC"] = str(args.ipc)
lock_wait_deadline = time.time() + min(max(1.5, float(args.timeout or 0.0)), 8.0)
lock_wait_logged = False
last_killed_pid_signature = ""
_lock_fh = None
while _lock_fh is None:
if platform.system() == "Windows":
try:
sibling_pids = [
@@ -1330,28 +1336,58 @@ def main(argv: Optional[list[str]] = None) -> int:
if pid and pid != os.getpid()
]
if sibling_pids:
signature = ",".join(str(pid) for pid in sibling_pids)
if signature != last_killed_pid_signature:
_append_helper_log(
f"[helper] terminating older helper pids for ipc={args.ipc}: {','.join(str(pid) for pid in sibling_pids)}"
f"[helper] terminating older helper pids for ipc={args.ipc}: {signature}"
)
last_killed_pid_signature = signature
_windows_kill_pids(sibling_pids)
time.sleep(0.25)
time.sleep(0.35)
except Exception as exc:
_append_helper_log(
f"[helper] failed to terminate older helpers: {type(exc).__name__}: {exc}"
)
# Ensure single helper instance per ipc.
_lock_fh = _acquire_ipc_lock(str(args.ipc))
if _lock_fh is None:
if _lock_fh is not None:
break
if not lock_wait_logged:
_append_helper_log(
f"[helper] another instance already holds lock for ipc={args.ipc}; exiting"
f"[helper] waiting for helper lock release ipc={args.ipc}"
)
lock_wait_logged = True
if time.time() >= lock_wait_deadline:
_append_helper_log(
f"[helper] another instance still holds lock for ipc={args.ipc}; exiting after wait"
)
return 0
time.sleep(0.20)
try:
_append_helper_log(
f"[helper] version={MEDEIA_MPV_HELPER_VERSION} started ipc={args.ipc}"
)
try:
_lock_fh.seek(0)
_lock_fh.truncate()
_lock_fh.write(
json.dumps(
{
"pid": os.getpid(),
"version": MEDEIA_MPV_HELPER_VERSION,
"ipc": str(args.ipc),
"started_at": int(time.time()),
},
ensure_ascii=False,
)
)
_lock_fh.flush()
except Exception:
pass
try:
_append_helper_log(
f"[helper] file={Path(__file__).resolve()} cwd={Path.cwd().resolve()}"