Generalized deemix gui file

This commit is contained in:
RemixDev 2020-05-15 17:58:27 +02:00
parent 12794b41b4
commit ac0d9b012e
2 changed files with 84 additions and 0 deletions

48
deemix_gui.py Normal file
View file

@ -0,0 +1,48 @@
#!/usr/env/bin python3
import webview
from threading import Thread, Lock
import sys
from time import sleep
from server import run_server
from http.client import HTTPConnection
from deemix.utils.localpaths import getConfigFolder
server_lock = Lock()
def url_ok(url, port):
try:
conn = HTTPConnection(url, port)
conn.request('GET', '/')
r = conn.getresponse()
return r.status == 200
except:
print("Server not started")
return False
if __name__ == '__main__':
url = "127.0.0.1"
if len(sys.argv) >= 2:
port = int(sys.argv[1])
else:
port = 9666
t = Thread(target=run_server, args=(port, ))
t.daemon = True
t.start()
while not url_ok(url, port):
sleep(1)
window = webview.create_window('deemix', 'http://'+url+':'+str(port))
if sys.platform == "win32":
from webview.platforms.cef import settings
settings.update({
'persist_session_cookies': True,
'cache_path': getConfigFolder()
})
webview.start(gui='cef', debug=True)
else:
webview.start(debug=True)
conn = HTTPConnection(url, port)
conn.request('GET', '/shutdown')
t.join()

36
deemix_gui.spec Normal file
View file

@ -0,0 +1,36 @@
# -*- mode: python ; coding: utf-8 -*-
block_cipher = None
a = Analysis(['deemix_win.py'],
binaries=[],
datas=[('public', 'public'), ('deemix/app/default.json','deemix/app'), ('./icon.ico', '.')],
hiddenimports=['engineio.async_drivers.threading', 'pkg_resources.py2_warn'],
hookspath=[],
runtime_hooks=[],
excludes=[],
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=block_cipher,
noarchive=False)
pyz = PYZ(a.pure, a.zipped_data,
cipher=block_cipher)
exe = EXE(pyz,
a.scripts,
[],
exclude_binaries=True,
name='deemix_win',
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=True,
console=True, icon='icon.ico' )
coll = COLLECT(exe,
a.binaries,
a.zipfiles,
a.datas,
strip=False,
upx=True,
upx_exclude=[],
name='deemix_win')