~naglis/aio_mpv_ipc

ede8aa31e37aeb4315eb8bee0eb28d9a8572f22b — Naglis Jonaitis 1 year, 3 months ago 379b00f
Drop loop argument
1 files changed, 2 insertions(+), 7 deletions(-)

M aio_mpv_ipc/_client.py
M aio_mpv_ipc/_client.py => aio_mpv_ipc/_client.py +2 -7
@@ 39,14 39,11 @@ async def start_mpv(
    *mpv_args: str,
    mpv_path: typing.Union[pathlib.Path, str] = "mpv",
    terminate: bool = False,
    loop: typing.Optional[asyncio.AbstractEventLoop] = None,
):
    if isinstance(socket_path, pathlib.Path):
        socket_path = str(socket_path.resolve(strict=False))
    if isinstance(mpv_path, pathlib.Path):
        mpv_path = str(mpv_path)
    if loop is None:
        loop = asyncio.get_running_loop()

    mpv = await asyncio.create_subprocess_exec(
        mpv_path, "--input-ipc-server", socket_path, *mpv_args


@@ 79,14 76,12 @@ class MpvClient:
        connect_sleep_timeout: float = 0.5,
        json_loads=_default_json_loads,
        json_dumps=_default_json_dumps,
        loop: typing.Optional[asyncio.AbstractEventLoop] = None,
    ) -> None:
        self._socket_path = socket_path
        self._reader, self._writer = None, None
        self._max_connect_attempts = max_connect_attempts
        self._connect_sleep_timeout = connect_sleep_timeout
        self._json_loads, self._json_dumps = json_loads, json_dumps
        self._loop = loop or asyncio.get_running_loop()
        self._poll_task = None

        self._request_counter = 0


@@ 121,7 116,7 @@ class MpvClient:
                )
                await asyncio.sleep(self._connect_sleep_timeout)

        self._poll_task = self._loop.create_task(self._poll())
        self._poll_task = asyncio.create_task(self._poll(), name="Poll mpv IPC socket")

        return self



@@ 186,7 181,7 @@ class MpvClient:
        fut = None
        if not nowait:
            request_id = self._request_counter
            fut = self._loop.create_future()
            fut = asyncio.get_running_loop().create_future()
            payload.update(request_id=request_id)
            self._futures.update({request_id: fut})