start work on mpv
This commit is contained in:
4 files changed
+93
-26
No files matched your search
@@ -45,4 +45,8 @@
|
|||||||
|
|
||||||
## Roadmap to Alpha 1
|
## Roadmap to Alpha 1
|
||||||
|
|
||||||

|
Estimated release date: 15 July, 2022
|
||||||
|
|
||||||
|
- [ ] Integration of libMPV for video playback (30% completed).
|
||||||
|
- [ ] Add Jellyplayer specific player function to jf-vue for video playback (1% completed).
|
||||||
|
- [ ] Use github action workflow to build JellyPlayer for multiple target OS.
|
||||||
+46
-24
@@ -1,6 +1,10 @@
|
|||||||
|
from mpv import MPV, MpvRenderContext, MpvGlGetProcAddressFn
|
||||||
__version__ = '0.1.0'
|
__version__ = '0.1.0'
|
||||||
|
|
||||||
import sys,os,subprocess,platform
|
import sys
|
||||||
|
import os
|
||||||
|
import subprocess
|
||||||
|
import platform
|
||||||
from signal import SIGTERM, signal
|
from signal import SIGTERM, signal
|
||||||
from PySide6.QtWidgets import QApplication, QMainWindow, QWidget
|
from PySide6.QtWidgets import QApplication, QMainWindow, QWidget
|
||||||
from PySide6.QtCore import QUrl, Slot, QObject, QProcess, Qt, QCoreApplication, Signal, QSize
|
from PySide6.QtCore import QUrl, Slot, QObject, QProcess, Qt, QCoreApplication, Signal, QSize
|
||||||
@@ -12,7 +16,7 @@ from PySide6.QtWebEngineQuick import QtWebEngineQuick
|
|||||||
from PySide6.QtQuick import QQuickFramebufferObject, QQuickView, QQuickItem
|
from PySide6.QtQuick import QQuickFramebufferObject, QQuickView, QQuickItem
|
||||||
from PySide6.QtOpenGL import QOpenGLFramebufferObject
|
from PySide6.QtOpenGL import QOpenGLFramebufferObject
|
||||||
from PySide6.QtOpenGLWidgets import QOpenGLWidget
|
from PySide6.QtOpenGLWidgets import QOpenGLWidget
|
||||||
from PySide6.QtQml import QQmlApplicationEngine, QQmlComponent,qmlRegisterType
|
from PySide6.QtQml import QQmlApplicationEngine, QQmlComponent, qmlRegisterType
|
||||||
from ctypes import windll, cast, c_void_p
|
from ctypes import windll, cast, c_void_p
|
||||||
|
|
||||||
# if (platform.system() == "Windows"):
|
# if (platform.system() == "Windows"):
|
||||||
@@ -20,8 +24,8 @@ from ctypes import windll, cast, c_void_p
|
|||||||
# else:
|
# else:
|
||||||
# from OpenGL import GL, GLX
|
# from OpenGL import GL, GLX
|
||||||
|
|
||||||
os.environ["PATH"] = os.path.dirname(__file__) + os.pathsep + os.environ["PATH"]
|
os.environ["PATH"] = os.path.dirname(
|
||||||
from mpv import MPV, MpvRenderContext, MpvGlGetProcAddressFn
|
__file__) + os.pathsep + os.environ["PATH"]
|
||||||
|
|
||||||
QCoreApplication.setAttribute(Qt.AA_ShareOpenGLContexts)
|
QCoreApplication.setAttribute(Qt.AA_ShareOpenGLContexts)
|
||||||
app = QApplication(["--enable-smooth-scrolling", "--enable-gpu"])
|
app = QApplication(["--enable-smooth-scrolling", "--enable-gpu"])
|
||||||
@@ -33,30 +37,48 @@ try:
|
|||||||
except ImportError:
|
except ImportError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
def restart():
|
def restart():
|
||||||
QApplication.quit()
|
QApplication.quit()
|
||||||
status = QProcess.startDetached(sys.executable, sys.argv)
|
status = QProcess.startDetached(sys.executable, sys.argv)
|
||||||
|
|
||||||
|
|
||||||
class Backend(QObject):
|
class Backend(QObject):
|
||||||
|
def __init__(self, player):
|
||||||
|
self.player = player
|
||||||
|
|
||||||
def restart(self):
|
def restart(self):
|
||||||
QApplication.quit()
|
QApplication.quit()
|
||||||
status = QProcess.startDetached(sys.executable, sys.argv)
|
status = QProcess.startDetached(sys.executable, sys.argv)
|
||||||
|
|
||||||
|
@Slot(str)
|
||||||
|
def play(self, url):
|
||||||
|
self.player.play(url)
|
||||||
|
|
||||||
|
@Slot(int)
|
||||||
|
def setTime(self, time):
|
||||||
|
self.player.setTime(time)
|
||||||
|
|
||||||
|
|
||||||
class MainWin(QMainWindow):
|
class MainWin(QMainWindow):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
self.dirRaw = os.path.dirname(os.path.realpath(__file__))
|
self.dirRaw = os.path.dirname(os.path.realpath(__file__))
|
||||||
self.dir = self.dirRaw.replace("\\","/")
|
self.dir = self.dirRaw.replace("\\", "/")
|
||||||
self.view= QWebEngineView()
|
self.view = QWebEngineView()
|
||||||
self.view.load(QUrl("http://localhost:2703"))
|
self.view.load(QUrl("http://localhost:3000"))
|
||||||
|
# self.view.load(QUrl("http://localhost:2703"))
|
||||||
|
self.view.raise_()
|
||||||
self.setCentralWidget(self.view)
|
self.setCentralWidget(self.view)
|
||||||
self.setWindowIcon(QIcon(QPixmap(f"{self.dir}/assets/icon.png")))
|
self.setWindowIcon(QIcon(QPixmap(f"{self.dir}/assets/icon.png")))
|
||||||
|
|
||||||
self.view.settings().setAttribute(QWebEngineSettings.JavascriptEnabled, True)
|
self.view.settings().setAttribute(QWebEngineSettings.JavascriptEnabled, True)
|
||||||
self.view.settings().setAttribute(QWebEngineSettings.PluginsEnabled, True)
|
self.view.settings().setAttribute(QWebEngineSettings.PluginsEnabled, True)
|
||||||
self.view.settings().setAttribute(QWebEngineSettings.LocalContentCanAccessRemoteUrls, True)
|
self.view.settings().setAttribute(
|
||||||
|
QWebEngineSettings.LocalContentCanAccessRemoteUrls, True)
|
||||||
self.view.settings().setAttribute(QWebEngineSettings.LocalStorageEnabled, True)
|
self.view.settings().setAttribute(QWebEngineSettings.LocalStorageEnabled, True)
|
||||||
self.view.settings().setAttribute(QWebEngineSettings.LocalContentCanAccessFileUrls, True)
|
self.view.settings().setAttribute(
|
||||||
|
QWebEngineSettings.LocalContentCanAccessFileUrls, True)
|
||||||
self.view.settings().setAttribute(QWebEngineSettings.ScrollAnimatorEnabled, True)
|
self.view.settings().setAttribute(QWebEngineSettings.ScrollAnimatorEnabled, True)
|
||||||
|
|
||||||
self.view.loadFinished.connect(self.handleLoaded)
|
self.view.loadFinished.connect(self.handleLoaded)
|
||||||
@@ -64,31 +86,31 @@ class MainWin(QMainWindow):
|
|||||||
self.inspector = QWebEngineView()
|
self.inspector = QWebEngineView()
|
||||||
self.inspector.setWindowTitle("Inspector")
|
self.inspector.setWindowTitle("Inspector")
|
||||||
|
|
||||||
self.backend = Backend()
|
self.backend = Backend(self.playerWid)
|
||||||
self.channel = QWebChannel()
|
self.channel = QWebChannel()
|
||||||
self.channel.registerObject('backend', self.backend)
|
self.channel.registerObject('backend', self.backend)
|
||||||
|
|
||||||
|
self.playerWid = QWidget(self)
|
||||||
|
self.playerWid.setMinimumHeight(self.view.height)
|
||||||
|
self.playerWid.setMinimumWidth(self.view.width)
|
||||||
|
self.playerWid.setAttribute(Qt.WA_DontCreateNativeAncestors)
|
||||||
|
self.playerWid.setAttribute(Qt.WA_NativeWindow)
|
||||||
|
self.playerWid.lower()
|
||||||
|
self.player = MPV(wid=str(int(self.playerWid.winId())),
|
||||||
|
gpu_context="d3d11",
|
||||||
|
hwdec="nvdec",
|
||||||
|
log_handler=print,
|
||||||
|
loglevel='debug')
|
||||||
|
|
||||||
def handleLoaded(self, ok):
|
def handleLoaded(self, ok):
|
||||||
if ok:
|
if ok:
|
||||||
self.view.page().setDevToolsPage(self.inspector.page())
|
self.view.page().setDevToolsPage(self.inspector.page())
|
||||||
self.inspector.show()
|
self.inspector.show()
|
||||||
|
|
||||||
def createPlayer(self, videoUrl):
|
|
||||||
self.container = QWidget(self)
|
|
||||||
self.setCentralWidget(self.container)
|
|
||||||
self.container.setAttribute(Qt.WA_DontCreateNativeAncestors)
|
|
||||||
self.container.setAttribute(Qt.WA_NativeWindow)
|
|
||||||
player = MPV(wid=str(int(self.container.winId())),
|
|
||||||
gpu_context="d3d11",
|
|
||||||
hwdec="nvdec",
|
|
||||||
log_handler=print,
|
|
||||||
loglevel='debug')
|
|
||||||
player.play(videoUrl)
|
|
||||||
|
|
||||||
|
# frontend = subprocess.Popen(f"python {os.path.dirname(os.path.realpath(__file__))}/jellyplayer-jellyfin-vue/frontend/dist/server.py", shell=True)
|
||||||
frontend= subprocess.Popen(f"python {os.path.dirname(os.path.realpath(__file__))}/jellyplayer-jellyfin-vue/frontend/dist/server.py", shell=True)
|
|
||||||
window = MainWin()
|
window = MainWin()
|
||||||
window.showMaximized()
|
window.showMaximized()
|
||||||
exitApp = app.exec()
|
exitApp = app.exec()
|
||||||
frontend.kill()
|
# frontend.kill()
|
||||||
sys.exit(exitApp)
|
sys.exit(exitApp)
|
||||||
Generated
+41
-1
@@ -28,6 +28,18 @@ docs = ["furo", "sphinx", "zope.interface", "sphinx-notfound-page"]
|
|||||||
tests = ["coverage[toml] (>=5.0.2)", "hypothesis", "pympler", "pytest (>=4.3.0)", "six", "mypy", "pytest-mypy-plugins", "zope.interface", "cloudpickle"]
|
tests = ["coverage[toml] (>=5.0.2)", "hypothesis", "pympler", "pytest (>=4.3.0)", "six", "mypy", "pytest-mypy-plugins", "zope.interface", "cloudpickle"]
|
||||||
tests_no_zope = ["coverage[toml] (>=5.0.2)", "hypothesis", "pympler", "pytest (>=4.3.0)", "six", "mypy", "pytest-mypy-plugins", "cloudpickle"]
|
tests_no_zope = ["coverage[toml] (>=5.0.2)", "hypothesis", "pympler", "pytest (>=4.3.0)", "six", "mypy", "pytest-mypy-plugins", "cloudpickle"]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "autopep8"
|
||||||
|
version = "1.6.0"
|
||||||
|
description = "A tool that automatically formats Python code to conform to the PEP 8 style guide"
|
||||||
|
category = "dev"
|
||||||
|
optional = false
|
||||||
|
python-versions = "*"
|
||||||
|
|
||||||
|
[package.dependencies]
|
||||||
|
pycodestyle = ">=2.8.0"
|
||||||
|
toml = "*"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "click"
|
name = "click"
|
||||||
version = "8.1.3"
|
version = "8.1.3"
|
||||||
@@ -203,6 +215,14 @@ category = "dev"
|
|||||||
optional = false
|
optional = false
|
||||||
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*"
|
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "pycodestyle"
|
||||||
|
version = "2.8.0"
|
||||||
|
description = "Python style guide checker"
|
||||||
|
category = "dev"
|
||||||
|
optional = false
|
||||||
|
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "pyinstaller"
|
name = "pyinstaller"
|
||||||
version = "5.0.1"
|
version = "5.0.1"
|
||||||
@@ -333,6 +353,14 @@ category = "main"
|
|||||||
optional = false
|
optional = false
|
||||||
python-versions = "<3.11,>=3.6"
|
python-versions = "<3.11,>=3.6"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "toml"
|
||||||
|
version = "0.10.2"
|
||||||
|
description = "Python Library for Tom's Obvious, Minimal Language"
|
||||||
|
category = "dev"
|
||||||
|
optional = false
|
||||||
|
python-versions = ">=2.6, !=3.0.*, !=3.1.*, !=3.2.*"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tomli"
|
name = "tomli"
|
||||||
version = "2.0.1"
|
version = "2.0.1"
|
||||||
@@ -387,7 +415,7 @@ testing = ["pytest (>=6)", "pytest-checkdocs (>=2.4)", "pytest-flake8", "pytest-
|
|||||||
[metadata]
|
[metadata]
|
||||||
lock-version = "1.1"
|
lock-version = "1.1"
|
||||||
python-versions = "~3.8"
|
python-versions = "~3.8"
|
||||||
content-hash = "e833a433cd43e523186875865be62d3a7e7cb88c807d487dcbf778f3494b6c1d"
|
content-hash = "211d7daff296440dc5ab6e8a40953f8245b930a81e39b137319c095f32b58c9b"
|
||||||
|
|
||||||
[metadata.files]
|
[metadata.files]
|
||||||
altgraph = [
|
altgraph = [
|
||||||
@@ -402,6 +430,10 @@ attrs = [
|
|||||||
{file = "attrs-21.4.0-py2.py3-none-any.whl", hash = "sha256:2d27e3784d7a565d36ab851fe94887c5eccd6a463168875832a1be79c82828b4"},
|
{file = "attrs-21.4.0-py2.py3-none-any.whl", hash = "sha256:2d27e3784d7a565d36ab851fe94887c5eccd6a463168875832a1be79c82828b4"},
|
||||||
{file = "attrs-21.4.0.tar.gz", hash = "sha256:626ba8234211db98e869df76230a137c4c40a12d72445c45d5f5b716f076e2fd"},
|
{file = "attrs-21.4.0.tar.gz", hash = "sha256:626ba8234211db98e869df76230a137c4c40a12d72445c45d5f5b716f076e2fd"},
|
||||||
]
|
]
|
||||||
|
autopep8 = [
|
||||||
|
{file = "autopep8-1.6.0-py2.py3-none-any.whl", hash = "sha256:ed77137193bbac52d029a52c59bec1b0629b5a186c495f1eb21b126ac466083f"},
|
||||||
|
{file = "autopep8-1.6.0.tar.gz", hash = "sha256:44f0932855039d2c15c4510d6df665e4730f2b8582704fa48f9c55bd3e17d979"},
|
||||||
|
]
|
||||||
click = [
|
click = [
|
||||||
{file = "click-8.1.3-py3-none-any.whl", hash = "sha256:bb4d8133cb15a609f44e8213d9b391b0809795062913b383c62be0ee95b1db48"},
|
{file = "click-8.1.3-py3-none-any.whl", hash = "sha256:bb4d8133cb15a609f44e8213d9b391b0809795062913b383c62be0ee95b1db48"},
|
||||||
{file = "click-8.1.3.tar.gz", hash = "sha256:7682dc8afb30297001674575ea00d1814d808d6a36af415a82bd481d37ba7b8e"},
|
{file = "click-8.1.3.tar.gz", hash = "sha256:7682dc8afb30297001674575ea00d1814d808d6a36af415a82bd481d37ba7b8e"},
|
||||||
@@ -502,6 +534,10 @@ py = [
|
|||||||
{file = "py-1.11.0-py2.py3-none-any.whl", hash = "sha256:607c53218732647dff4acdfcd50cb62615cedf612e72d1724fb1a0cc6405b378"},
|
{file = "py-1.11.0-py2.py3-none-any.whl", hash = "sha256:607c53218732647dff4acdfcd50cb62615cedf612e72d1724fb1a0cc6405b378"},
|
||||||
{file = "py-1.11.0.tar.gz", hash = "sha256:51c75c4126074b472f746a24399ad32f6053d1b34b68d2fa41e558e6f4a98719"},
|
{file = "py-1.11.0.tar.gz", hash = "sha256:51c75c4126074b472f746a24399ad32f6053d1b34b68d2fa41e558e6f4a98719"},
|
||||||
]
|
]
|
||||||
|
pycodestyle = [
|
||||||
|
{file = "pycodestyle-2.8.0-py2.py3-none-any.whl", hash = "sha256:720f8b39dde8b293825e7ff02c475f3077124006db4f440dcbc9a20b76548a20"},
|
||||||
|
{file = "pycodestyle-2.8.0.tar.gz", hash = "sha256:eddd5847ef438ea1c7870ca7eb78a9d47ce0cdb4851a5523949f2601d0cbbe7f"},
|
||||||
|
]
|
||||||
pyinstaller = [
|
pyinstaller = [
|
||||||
{file = "pyinstaller-5.0.1-py3-none-macosx_10_13_universal2.whl", hash = "sha256:0dc19ccf97584fff1766dcaf9c0425e4cd714ccc41c9f4d1222cab8c756624e4"},
|
{file = "pyinstaller-5.0.1-py3-none-macosx_10_13_universal2.whl", hash = "sha256:0dc19ccf97584fff1766dcaf9c0425e4cd714ccc41c9f4d1222cab8c756624e4"},
|
||||||
{file = "pyinstaller-5.0.1-py3-none-manylinux2014_aarch64.whl", hash = "sha256:100ba42f5885e1044e45a9a1d6fa9bb17be49d8731a34ebde39519a49095d509"},
|
{file = "pyinstaller-5.0.1-py3-none-manylinux2014_aarch64.whl", hash = "sha256:100ba42f5885e1044e45a9a1d6fa9bb17be49d8731a34ebde39519a49095d509"},
|
||||||
@@ -559,6 +595,10 @@ shiboken6 = [
|
|||||||
{file = "shiboken6-6.3.0-cp36-abi3-manylinux_2_28_x86_64.whl", hash = "sha256:e68e3cbb595c3047c4d893b84ef88eb5b23dea4e94241e80f5509dcb6613ad3d"},
|
{file = "shiboken6-6.3.0-cp36-abi3-manylinux_2_28_x86_64.whl", hash = "sha256:e68e3cbb595c3047c4d893b84ef88eb5b23dea4e94241e80f5509dcb6613ad3d"},
|
||||||
{file = "shiboken6-6.3.0-cp36-abi3-win_amd64.whl", hash = "sha256:096e6b2254e59729ae61acbb80d09c31ad7ea35b6624ec120c15a35b95c70b69"},
|
{file = "shiboken6-6.3.0-cp36-abi3-win_amd64.whl", hash = "sha256:096e6b2254e59729ae61acbb80d09c31ad7ea35b6624ec120c15a35b95c70b69"},
|
||||||
]
|
]
|
||||||
|
toml = [
|
||||||
|
{file = "toml-0.10.2-py2.py3-none-any.whl", hash = "sha256:806143ae5bfb6a3c6e736a764057db0e6a0e05e338b5630894a5f779cabb4f9b"},
|
||||||
|
{file = "toml-0.10.2.tar.gz", hash = "sha256:b3bda1d108d5dd99f4a20d24d9c348e91c4db7ab1b749200bded2f839ccbe68f"},
|
||||||
|
]
|
||||||
tomli = [
|
tomli = [
|
||||||
{file = "tomli-2.0.1-py3-none-any.whl", hash = "sha256:939de3e7a6161af0c887ef91b7d41a53e7c5a1ca976325f429cb46ea9bc30ecc"},
|
{file = "tomli-2.0.1-py3-none-any.whl", hash = "sha256:939de3e7a6161af0c887ef91b7d41a53e7c5a1ca976325f429cb46ea9bc30ecc"},
|
||||||
{file = "tomli-2.0.1.tar.gz", hash = "sha256:de526c12914f0c550d15924c62d72abc48d6fe7364aa87328337a31007fe8a4f"},
|
{file = "tomli-2.0.1.tar.gz", hash = "sha256:de526c12914f0c550d15924c62d72abc48d6fe7364aa87328337a31007fe8a4f"},
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ PyOpenGL = "^3.1.6"
|
|||||||
[tool.poetry.dev-dependencies]
|
[tool.poetry.dev-dependencies]
|
||||||
pytest = "~5.2"
|
pytest = "~5.2"
|
||||||
poethepoet = "^0.13.1"
|
poethepoet = "^0.13.1"
|
||||||
|
autopep8 = "^1.6.0"
|
||||||
|
|
||||||
[tool.poe.tasks]
|
[tool.poe.tasks]
|
||||||
jellyplayer = "python jellyplayer/__init__.py"
|
jellyplayer = "python jellyplayer/__init__.py"
|
||||||
|
|||||||
Reference in new issue
Block a user