oops, forgot a new file

This commit is contained in:
Christoph Stahl 2022-11-24 19:40:22 +01:00
parent c9add5fa96
commit fcb10f7d10

15
syng/sources/common.py Normal file
View file

@ -0,0 +1,15 @@
from __future__ import annotations
import asyncio
async def play_mpv(
video: str, audio: str | None, options
) -> asyncio.subprocess.Process:
args = [*options, video] + ([f"--audio-file={audio}"] if audio else [])
mpv_process = asyncio.create_subprocess_exec("mpv", *args)
return await mpv_process
def kill_mpv(mpv: asyncio.subprocess.Process):
mpv.terminate()