grzegorz/mpv_control.py

23 lines
536 B
Python
Raw Normal View History

2016-09-11 20:59:45 +02:00
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'
2016-09-13 20:57:45 +02:00
, '--vo drm'
2016-09-11 20:59:45 +02:00
])
super().__init__(debug=True)
def play(self, url):
2016-09-11 21:38:58 +02:00
self.command("loadfile", url)
2016-09-11 20:59:45 +02:00
self.set_property("pause", False)
2016-09-13 20:57:45 +02:00
2016-09-11 20:59:45 +02:00
@staticmethod
def fetchTitle(url):
return ydl.extract_info(url, download=False).get('title')
mpv = MPV()