This commit is contained in:
2026-03-26 23:00:25 -07:00
parent 562acd809c
commit 37bb4ca685
8 changed files with 368 additions and 123 deletions

View File

@@ -769,76 +769,6 @@ class MPV:
**kwargs,
)
# Start the persistent pipeline helper eagerly so MPV Lua can issue
# non-blocking requests (e.g., format list prefetch) without needing
# to spawn the helper on-demand from inside mpv.
try:
helper_path = (repo_root / "MPV" / "pipeline_helper.py").resolve()
if helper_path.exists():
py = sys.executable or "python"
if platform.system() == "Windows":
py = _windows_pythonw_exe(py) or py
helper_cmd = [
py,
str(helper_path),
"--ipc",
str(self.ipc_path),
"--timeout",
"30",
]
helper_env = os.environ.copy()
try:
existing_pp = helper_env.get("PYTHONPATH")
helper_env["PYTHONPATH"] = (
str(repo_root) if not existing_pp else
(str(repo_root) + os.pathsep + str(existing_pp))
)
except Exception:
pass
helper_kwargs: Dict[str,
Any] = {}
if platform.system() == "Windows":
flags = 0
try:
flags |= int(
getattr(subprocess,
"DETACHED_PROCESS",
0x00000008)
)
except Exception:
flags |= 0x00000008
try:
flags |= int(
getattr(subprocess,
"CREATE_NO_WINDOW",
0x08000000)
)
except Exception:
flags |= 0x08000000
helper_kwargs["creationflags"] = flags
helper_kwargs.update(
{
k: v
for k, v in _windows_hidden_subprocess_kwargs().items()
if k != "creationflags"
}
)
helper_kwargs["cwd"] = str(repo_root)
helper_kwargs["env"] = helper_env
subprocess.Popen(
helper_cmd,
stdin=subprocess.DEVNULL,
stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL,
**helper_kwargs,
)
except Exception:
pass
def get_ipc_pipe_path() -> str:
"""Get the fixed IPC pipe/socket path for persistent MPV connection.