From 29f1e2ba1a2ef2a5f94eda7f52697cab159dccb2 Mon Sep 17 00:00:00 2001 From: Prayag Prajapati Date: Wed, 23 Nov 2022 18:43:06 +0530 Subject: [PATCH] Add new frontend --- .gitmodules | 3 -- README.md | 53 +------------------------ jellyplayer/__init__.py | 58 ++++++++++++++-------------- jellyplayer/jellyplayer-jellyfin-vue | 1 - jellyplayer/mainWindow.qml | 41 -------------------- jellyplayer/main_win.spec | 2 +- pyproject.toml | 4 +- 7 files changed, 33 insertions(+), 129 deletions(-) delete mode 160000 jellyplayer/jellyplayer-jellyfin-vue delete mode 100644 jellyplayer/mainWindow.qml diff --git a/.gitmodules b/.gitmodules index 42df0c3..e69de29 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +0,0 @@ -[submodule "jellyplayer/jellyplayer-jellyfin-vue"] - path = jellyplayer/jellyplayer-jellyfin-vue - url = https://github.com/prayag17/jellyplayer-jellyfin-vue.git diff --git a/README.md b/README.md index 8cc072d..7466725 100644 --- a/README.md +++ b/README.md @@ -1,52 +1,3 @@ -# JellyPlayer +# JellyPlayer : Modern Jellyfin Client -## Modern Jellyfin Client - -## Note: The development of this client is on halt as I am waiting for jf-vue project(frontend for this project) to catch up to vue3 - -## Installation - -- Install Requirements: - - Install Python 3 - - Install dependencies - - Install node deps for frontend, go to JellyPlayer-FrontEnd dir and run the following command - - ```console - npm install - ``` - - - Install Python deps - - ```console - pip3 install -r requirements.txt --default-timeout=1000 - ``` - -- Run App: - - - Complie Renderer Files(html,js,css):\ - Go to JellyPlayer-FrontEnd dir and run.\ - **Note: on windows use WSL to compile** - - ```console - npm run build - ``` - - - Run JellyPlayer: - - ```console - python3 main.py - ``` - - - -## Roadmap to Alpha 1 - -- [ ] 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. +## DOCS TO BE AVAILABLE SOON :) diff --git a/jellyplayer/__init__.py b/jellyplayer/__init__.py index 981d9e6..03dd48e 100644 --- a/jellyplayer/__init__.py +++ b/jellyplayer/__init__.py @@ -1,32 +1,23 @@ -from mpv import MPV, MpvRenderContext, MpvGlGetProcAddressFn -__version__ = '0.1.0' - +from ctypes import windll, cast, c_void_p +from PySide6.QtWebEngineCore import QWebEngineSettings +from PySide6.QtWebEngineWidgets import QWebEngineView +from PySide6.QtWebChannel import QWebChannel +from PySide6.QtGui import QIcon, QPixmap +from PySide6.QtCore import QUrl, Slot, QObject, QProcess, Qt, QCoreApplication, QMessageLogContext +from PySide6.QtWidgets import QApplication, QMainWindow, QWidget +from signal import SIGTERM, signal +import platform +import subprocess import sys import os -import subprocess -import platform -from signal import SIGTERM, signal -from PySide6.QtWidgets import QApplication, QMainWindow, QWidget -from PySide6.QtCore import QUrl, Slot, QObject, QProcess, Qt, QCoreApplication, Signal, QSize -from PySide6.QtGui import QIcon, QPixmap, QOpenGLContext -from PySide6.QtWebChannel import QWebChannel -from PySide6.QtWebEngineWidgets import QWebEngineView -from PySide6.QtWebEngineCore import QWebEngineSettings -from PySide6.QtWebEngineQuick import QtWebEngineQuick -from PySide6.QtQuick import QQuickFramebufferObject, QQuickView, QQuickItem -from PySide6.QtOpenGL import QOpenGLFramebufferObject -from PySide6.QtOpenGLWidgets import QOpenGLWidget -from PySide6.QtQml import QQmlApplicationEngine, QQmlComponent, qmlRegisterType -from ctypes import windll, cast, c_void_p - -# if (platform.system() == "Windows"): -# from OpenGL import GL, WGL -# else: -# from OpenGL import GL, GLX os.environ["PATH"] = os.path.dirname( __file__) + os.pathsep + os.environ["PATH"] +from mpv import MPV, MpvRenderContext + +__version__ = '0.1.0' + QCoreApplication.setAttribute(Qt.AA_ShareOpenGLContexts) app = QApplication(["--enable-smooth-scrolling", "--enable-gpu"]) print(os.path.dirname(__file__) + os.pathsep) @@ -45,6 +36,7 @@ def restart(): class Backend(QObject): def __init__(self, player): + super().__init__() self.player = player def restart(self): @@ -59,6 +51,12 @@ class Backend(QObject): def setTime(self, time): self.player.setTime(time) + @Slot(result=int) + def getTime(self): + return self.player.time_pos + + +# def filehandler() class MainWin(QMainWindow): def __init__(self): @@ -67,7 +65,7 @@ class MainWin(QMainWindow): self.dir = self.dirRaw.replace("\\", "/") self.view = QWebEngineView() self.view.load(QUrl("http://localhost:3000")) - # self.view.load(QUrl("http://localhost:2703")) + # self.view.load(QUrl("http://localhost:17066")) self.view.raise_() self.setCentralWidget(self.view) self.setWindowIcon(QIcon(QPixmap(f"{self.dir}/assets/icon.png"))) @@ -86,13 +84,9 @@ class MainWin(QMainWindow): self.inspector = QWebEngineView() self.inspector.setWindowTitle("Inspector") - self.backend = Backend(self.playerWid) - self.channel = QWebChannel() - self.channel.registerObject('backend', self.backend) - self.playerWid = QWidget(self) - self.playerWid.setMinimumHeight(self.view.height) - self.playerWid.setMinimumWidth(self.view.width) + 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() @@ -102,6 +96,10 @@ class MainWin(QMainWindow): log_handler=print, loglevel='debug') + self.backend = Backend(self.playerWid) + self.channel = QWebChannel() + self.channel.registerObject('backend', self.backend) + def handleLoaded(self, ok): if ok: self.view.page().setDevToolsPage(self.inspector.page()) diff --git a/jellyplayer/jellyplayer-jellyfin-vue b/jellyplayer/jellyplayer-jellyfin-vue deleted file mode 160000 index 352916c..0000000 --- a/jellyplayer/jellyplayer-jellyfin-vue +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 352916c734fdc885087a4ae51024df267fb1f017 diff --git a/jellyplayer/mainWindow.qml b/jellyplayer/mainWindow.qml deleted file mode 100644 index ef387a9..0000000 --- a/jellyplayer/mainWindow.qml +++ /dev/null @@ -1,41 +0,0 @@ -import QtWebEngine -import QtWebChannel -import QtQuick -import QtQuick.Controls - -import WebView - -Item{ - id: window - objectName: "window" - // minimumHeight: 720 - // minimumWidth: 1280 - // visible: true - - // QtObject{ - // id:mpvComObj - // WebChannel.id: backend - // function createMpv(url) { - // video.play(url) - // } - // } - - // MpvObject{ - // id:video; - // anchors.fill: parent - // } - - // WebChannel{ - // id: channel - // registeredObjects: [mpvComObj] - // } - - WebView { - id:webView; - visible: true; - width: mainWindow.width; - height: mainWindow.height; - anchors.fill: parent; - } - // property QtObject webChannel: webView.webChannel -} \ No newline at end of file diff --git a/jellyplayer/main_win.spec b/jellyplayer/main_win.spec index d84eda4..7bc1442 100644 --- a/jellyplayer/main_win.spec +++ b/jellyplayer/main_win.spec @@ -7,7 +7,7 @@ block_cipher = None a = Analysis(['__init__.py'], pathex=['D:\\Jellyfin\\JellyPlayer\\jellyplayer'], binaries=[], - datas=[('jellyplayer-jellyfin-vue/frontend/dist', 'jellyplayer-jellyfin-vue/frontend/dist'), ('mainWindow.qml', '.')], + datas=[('jellyplayer-jellyfin-vue/frontend/dist', 'jellyplayer-jellyfin-vue/frontend/dist')], hiddenimports=[], hookspath=[], hooksconfig={}, diff --git a/pyproject.toml b/pyproject.toml index 7bd533a..3944270 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -14,7 +14,7 @@ keywords = [ ] [tool.poetry.dependencies] -python = "~3.8" +python = "^3.10" PySide6 = "^6.3.0" Flask = "^2.1.2" waitress = "^2.1.1" @@ -25,7 +25,7 @@ PyOpenGL = "^3.1.6" [tool.poetry.dev-dependencies] pytest = "~5.2" poethepoet = "^0.13.1" -autopep8 = "^1.6.0" +autopep8 = "^1.6.0" [tool.poe.tasks] jellyplayer = "python jellyplayer/__init__.py"