add mpv_control.py

This commit is contained in:
Aleksander Gustaw Wasaznik 2016-09-11 20:59:45 +02:00
parent a22d403e46
commit 048455d6e9
4 changed files with 28 additions and 89 deletions

90
.gitignore vendored
View File

@ -1,89 +1 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class
# C extensions
*.so
# Distribution / packaging
.Python
env/
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
*.egg-info/
.installed.cfg
*.egg
# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec
# Installer logs
pip-log.txt
pip-delete-this-directory.txt
# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*,cover
.hypothesis/
# Translations
*.mo
*.pot
# Django stuff:
*.log
local_settings.py
# Flask stuff:
instance/
.webassets-cache
# Scrapy stuff:
.scrapy
# Sphinx documentation
docs/_build/
# PyBuilder
target/
# IPython Notebook
.ipynb_checkpoints
# pyenv
.python-version
# celery beat schedule file
celerybeat-schedule
# dotenv
.env
# virtualenv
venv/
ENV/
# Spyder project settings
.spyderproject
# Rope project settings
.ropeproject
*.pyc

3
.gitmodules vendored Normal file
View File

@ -0,0 +1,3 @@
[submodule "python-mpv"]
path = lib/python_mpv
url = https://github.com/gustaebel/python-mpv.git

22
mpv_control.py Normal file
View File

@ -0,0 +1,22 @@
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):
self.command("loadfile", path)
self.set_property("pause", False)
@staticmethod
def fetchTitle(url):
return ydl.extract_info(url, download=False).get('title')
mpv = MPV()

2
requirements.txt Normal file
View File

@ -0,0 +1,2 @@
mpv==0.1
youtube-dl==2016.9.11.1