grzegorz/mpv_control.py

22 lines
515 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'
])
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)
@staticmethod
def fetchTitle(url):
return ydl.extract_info(url, download=False).get('title')
mpv = MPV()