grzegorz/mpv_control.py

23 lines
536 B
Python

from lib.python_mpv.mpv import MPV as next_MPV
import youtube_dl
ydl = youtube_dl.YoutubeDL()
class MPV(next_MPV):
def __init__(self):
self.default_argv += (
[ '--keep-open'
, '--force-window'
, '--vo drm'
])
super().__init__(debug=True)
def play(self, url):
self.command("loadfile", url)
self.set_property("pause", False)
@staticmethod
def fetchTitle(url):
return ydl.extract_info(url, download=False).get('title')
mpv = MPV()