oops, forgot a new file
This commit is contained in:
parent
c9add5fa96
commit
fcb10f7d10
1 changed files with 15 additions and 0 deletions
15
syng/sources/common.py
Normal file
15
syng/sources/common.py
Normal 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()
|
Loading…
Add table
Reference in a new issue