diff --git a/.gitignore b/.gitignore index 72364f9..0d20b64 100644 --- a/.gitignore +++ b/.gitignore @@ -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 diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..62d2a2b --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "python-mpv"] + path = lib/python_mpv + url = https://github.com/gustaebel/python-mpv.git diff --git a/mpv_control.py b/mpv_control.py new file mode 100644 index 0000000..294e279 --- /dev/null +++ b/mpv_control.py @@ -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() \ No newline at end of file diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..d24e40d --- /dev/null +++ b/requirements.txt @@ -0,0 +1,2 @@ +mpv==0.1 +youtube-dl==2016.9.11.1