remove qml
This commit is contained in:
7 files changed
+174
-68
No files matched your search
+45
-29
@@ -1,20 +1,33 @@
|
||||
__version__ = '0.1.0'
|
||||
|
||||
import sys,os,subprocess
|
||||
import sys,os,subprocess,platform
|
||||
from signal import SIGTERM, signal
|
||||
from PySide6.QtWidgets import QApplication, QMainWindow, QWidget
|
||||
from PySide6.QtCore import QUrl, Slot, QObject, QProcess, Qt, QCoreApplication
|
||||
from PySide6.QtGui import QIcon, QPixmap
|
||||
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.QtQml import QQmlApplicationEngine
|
||||
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"]
|
||||
import mpv
|
||||
from mpv import MPV, MpvRenderContext, MpvGlGetProcAddressFn
|
||||
|
||||
QCoreApplication.setAttribute(Qt.AA_ShareOpenGLContexts)
|
||||
app = QApplication(["--enable-smooth-scrolling", "--enable-gpu"])
|
||||
print(os.path.dirname(__file__) + os.pathsep)
|
||||
|
||||
try:
|
||||
from ctypes import windll
|
||||
myappid = 'prayag17.jellyplayer.0.1.0'
|
||||
windll.shell32.SetCurrentProcessExplicitAppUserModelID(myappid)
|
||||
except ImportError:
|
||||
@@ -28,51 +41,54 @@ class Backend(QObject):
|
||||
def restart(self):
|
||||
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()
|
||||
|
||||
class MainWin():
|
||||
class MainWin(QMainWindow):
|
||||
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.view= QWebEngineView()
|
||||
self.view.load(QUrl("http://localhost:2703"))
|
||||
self.setCentralWidget(self.view)
|
||||
self.setWindowIcon(QIcon(QPixmap(f"{self.dir}/assets/icon.png")))
|
||||
|
||||
app.setWindowIcon(QIcon(QPixmap(f"{self.dir}/assets/icon.png")))
|
||||
self.view.load(QUrl.fromLocalFile(f"{self.dir}/mainWindow.qml"))
|
||||
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.LocalStorageEnabled, True)
|
||||
self.view.settings().setAttribute(QWebEngineSettings.LocalContentCanAccessFileUrls, True)
|
||||
self.view.settings().setAttribute(QWebEngineSettings.ScrollAnimatorEnabled, True)
|
||||
|
||||
self.view.loadFinished.connect(self.handleLoaded)
|
||||
|
||||
self.inspector = QWebEngineView()
|
||||
self.inspector.setWindowTitle("Inspector")
|
||||
|
||||
self.backend = Backend()
|
||||
self.channel = QWebChannel()
|
||||
self.channel.registerObject('backend', self.backend)
|
||||
|
||||
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())),
|
||||
player = 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):
|
||||
super().__init__()
|
||||
|
||||
|
||||
|
||||
frontendProcess = subprocess.Popen(f'{sys.executable} {os.path.dirname(__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()
|
||||
|
||||
print(window.dir)
|
||||
window.showMaximized()
|
||||
exitApp = app.exec()
|
||||
os.kill(frontendProcess.pid, 0)
|
||||
frontend.kill()
|
||||
sys.exit(exitApp)
|
||||
Submodule jellyplayer/jellyplayer-jellyfin-vue updated: 0b9c08f691...c65568bbed.
+31
-17
@@ -1,27 +1,41 @@
|
||||
import QtWebEngine
|
||||
// import QtWebEngine.WebEngineSettings
|
||||
import QtWebChannel
|
||||
import QtQuick.Window
|
||||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
|
||||
Window{
|
||||
id: mainWindow
|
||||
title: "Jellyfin Player"
|
||||
objectName: "mainWindow"
|
||||
minimumHeight: 720
|
||||
minimumWidth: 1280
|
||||
visible: true
|
||||
import WebView
|
||||
|
||||
WebEngineView{
|
||||
id:webView
|
||||
url:"http://127.0.0.1:5000";
|
||||
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;
|
||||
settings.localStorageEnabled: true;
|
||||
settings.localContentCanAccessRemoteUrls: true;
|
||||
settings.localContentCanAccessFileUrls: true;
|
||||
settings.javascriptEnabled: true;
|
||||
}
|
||||
property QtObject webChannel: webView.webChannel
|
||||
// property QtObject webChannel: webView.webChannel
|
||||
}
|
||||
@@ -4,10 +4,10 @@
|
||||
block_cipher = None
|
||||
|
||||
|
||||
a = Analysis(['main.py'],
|
||||
pathex=[],
|
||||
a = Analysis(['__init__.py'],
|
||||
pathex=['D:\\Jellyfin\\JellyPlayer\\jellyplayer'],
|
||||
binaries=[],
|
||||
datas=[('JellyPlayer-FrontEnd/frontend/dist', 'mainWindow.qml')],
|
||||
datas=[('jellyplayer-jellyfin-vue/frontend/dist', 'jellyplayer-jellyfin-vue/frontend/dist'), ('mainWindow.qml', '.')],
|
||||
hiddenimports=[],
|
||||
hookspath=[],
|
||||
hooksconfig={},
|
||||
@@ -29,7 +29,7 @@ exe = EXE(pyz,
|
||||
bootloader_ignore_signals=False,
|
||||
strip=False,
|
||||
upx=True,
|
||||
console=False,
|
||||
console=True,
|
||||
disable_windowed_traceback=False,
|
||||
target_arch=None,
|
||||
codesign_identity=None,
|
||||
@@ -42,4 +42,4 @@ coll = COLLECT(exe,
|
||||
strip=False,
|
||||
upx=True,
|
||||
upx_exclude=[],
|
||||
name='JellyPlayer')
|
||||
name='main_win')
|
||||
@@ -0,0 +1,15 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Document</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<h1>HEllorn vun</h1>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
Reference in new issue
Block a user