Move to Jellyfin-vue

This commit is contained in:
Prayag committed 2022-04-27 19:30:33 +05:30
1 parent af646276d5
commit cbe87e0c05
20 files changed
+198 -120319

No files matched your search

+47 -47
View File
@@ -1,14 +1,18 @@
import sys,os,requests
import sys,os,requests,subprocess,time,signal
from localStoragePy import localStoragePy
from PySide6.QtWidgets import QApplication, QMainWindow, QWidget
from PySide6.QtCore import QUrl, Slot, QObject, QProcess
from PySide6.QtGui import QIcon, QPixmap
from PySide6.QtWidgets import QApplication, QMainWindow, QWidget, QSlider, QVBoxLayout, QFrame, QHBoxLayout, QPushButton
from PySide6.QtCore import QUrl, Slot, QObject, QProcess, Qt, QTimer
from PySide6.QtGui import QIcon, QPixmap, QPalette, QColor, QAction
from PySide6.QtWebEngineWidgets import QWebEngineView
from PySide6.QtWebEngineCore import QWebEngineSettings
from PySide6.QtWebChannel import QWebChannel
# import mpv
import renderer
app = QApplication(["--disable-gpu-driver-bug-workarounds", "--enable-gpu-rasterization"])
from PySide6.QtQuick import QQuickView
from PySide6.QtQml import QQmlApplicationEngine
os.environ["PATH"] = os.path.dirname(__file__) + os.pathsep + os.environ["PATH"]
import mpv
app = QApplication(["--disable-gpu-driver-bug-workarounds", "--enable-smooth-scrolling"])
print(os.path.dirname(__file__) + os.pathsep)
try:
from ctypes import windll
@@ -89,54 +93,50 @@ class Backend(QObject):
QApplication.quit()
status = QProcess.startDetached(sys.executable, sys.argv)
# @Slot(str)
# def launchPlayer(self, videoUrl):
# import locale
# locale.setlocale(locale.LC_NUMERIC, 'C')
# playerwindow = PlayerWindow(videoUrl)
# window.hide()
# playerwindow.showMaximized()
@Slot(str)
def launchPlayer(self, videoUrl):
import locale
locale.setlocale(locale.LC_NUMERIC, 'C')
playerwindow = PlayerWindow(videoUrl)
window.hide()
playerwindow.showMaximized()
class LoginWin(QMainWindow):
class MainWin():
def __init__(self):
super().__init__()
super().__init__();
self.dirRaw = os.path.dirname(os.path.realpath(__file__))
self.dir = self.dirRaw.replace("\\","/")
self.view= QQmlApplicationEngine()
self.dir = os.path.dirname(os.path.abspath(__file__))
self.view= QWebEngineView(self)
self.setCentralWidget(self.view)
self.view.settings().setAttribute(QWebEngineSettings.JavascriptEnabled, True)
self.view.settings().setAttribute(QWebEngineSettings.PluginsEnabled, True)
self.view.settings().setAttribute(QWebEngineSettings.LocalContentCanAccessRemoteUrls, True)
self.view.settings().setAttribute(QWebEngineSettings.ScrollAnimatorEnabled, True)
self.setWindowTitle('JellyPlayer')
self.setWindowIcon(QIcon(QPixmap(":/assets/icon.png")))
self.view.load(QUrl("qrc:/renderer/html/main.html"))
self.view.loadFinished.connect(self.handleLoaded)
self.inspector = QWebEngineView()
self.inspector.setWindowTitle("Inspector")
app.setWindowIcon(QIcon(QPixmap("./assets/icon.png")))
self.view.load(QUrl.fromLocalFile(f"{self.dir}/mainWindow.qml"))
self.backend = Backend()
self.channel = QWebChannel()
self.channel.registerObject('backend', self.backend)
self.view.page().setWebChannel(self.channel)
def handleLoaded(self, ok):
if ok:
self.view.page().setDevToolsPage(self.inspector.page())
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.MPV(wid=str(int(self.container.winId())),
gpu_context="d3d11",
hwdec="nvdec",
log_handler=print,
loglevel='debug')
player.play(videoUrl)
# class PlayerWindow(QMainWindow):
# def __init__(self,videoUrl,parent=None):
# super().__init__(parent)
# self.container = QWidget(self)
# self.setCentralWidget(self.container)
# player = mpv.MPV(wid=str(int(self.container.winId())))
# player.play(videoUrl)
class PlayerWindow(QMainWindow):
def __init__(self,videoUrl):
super().__init__()
window = LoginWin()
window.showMaximized()
sys.exit(app.exec())
frontendProcess = subprocess.Popen(f'{sys.executable} {os.path.dirname(__file__)}/JellyPlayer-FrontEnd/frontend/dist/server.py', shell=True)
window = MainWin()
print(window.dir)
exitApp = app.exec()
os.kill(frontendProcess.pid, 0)
sys.exit(exitApp)