update refactoring and add new features

This commit is contained in:
2026-07-24 20:55:58 -07:00
parent 7f12bc7f40
commit 03fbbbcf28
69 changed files with 16332 additions and 17600 deletions
+2 -4
View File
@@ -7,6 +7,7 @@ This is the central hub for all Python-mpv IPC communication. The Lua script
should use the Python CLI, which uses this module to manage mpv connections.
"""
import atexit
import ctypes
import json
import os
@@ -901,6 +902,7 @@ class MPVIPCClient:
self.is_windows = platform.system() == "Windows"
self.silent = bool(silent)
self._recv_buffer: bytes = b""
atexit.register(self.disconnect)
def _write_payload(self, payload: str) -> None:
if not self.sock:
@@ -1229,10 +1231,6 @@ class MPVIPCClient:
self.sock = None
self._recv_buffer = b""
def __del__(self) -> None:
"""Cleanup on object destruction."""
self.disconnect()
def __enter__(self):
"""Context manager entry."""
self.connect()