Implemented GUI for syng #2
4 changed files with 25 additions and 9 deletions
|
@ -48,6 +48,7 @@ from typing import Optional
|
||||||
import qrcode
|
import qrcode
|
||||||
|
|
||||||
import socketio
|
import socketio
|
||||||
|
import engineio
|
||||||
from PIL import Image
|
from PIL import Image
|
||||||
|
|
||||||
from . import jsonencoder
|
from . import jsonencoder
|
||||||
|
@ -375,8 +376,11 @@ async def handle_request_config(data: dict[str, Any]) -> None:
|
||||||
await sio.emit("config", {"source": data["source"], "config": config})
|
await sio.emit("config", {"source": data["source"], "config": config})
|
||||||
|
|
||||||
|
|
||||||
def terminate(*args):
|
def signal_handler():
|
||||||
print("OOPS")
|
engineio.async_client.async_signal_handler()
|
||||||
|
if state.current_source is not None:
|
||||||
|
if state.current_source.player is not None:
|
||||||
|
state.current_source.player.kill()
|
||||||
|
|
||||||
|
|
||||||
async def start_client(config: dict[str, Any]) -> None:
|
async def start_client(config: dict[str, Any]) -> None:
|
||||||
|
@ -408,8 +412,18 @@ async def start_client(config: dict[str, Any]) -> None:
|
||||||
state.config["key"] = ""
|
state.config["key"] = ""
|
||||||
|
|
||||||
await sio.connect(state.config["server"])
|
await sio.connect(state.config["server"])
|
||||||
|
|
||||||
|
asyncio.get_event_loop().add_signal_handler(signal.SIGINT, signal_handler)
|
||||||
|
asyncio.get_event_loop().add_signal_handler(signal.SIGTERM, signal_handler)
|
||||||
|
|
||||||
|
try:
|
||||||
await sio.wait()
|
await sio.wait()
|
||||||
print("exit")
|
except asyncio.CancelledError:
|
||||||
|
pass
|
||||||
|
finally:
|
||||||
|
if state.current_source is not None:
|
||||||
|
if state.current_source.player is not None:
|
||||||
|
state.current_source.player.kill()
|
||||||
|
|
||||||
|
|
||||||
def create_async_and_start_client(config):
|
def create_async_and_start_client(config):
|
||||||
|
|
|
@ -322,10 +322,10 @@ class SyngGui(customtkinter.CTk):
|
||||||
)
|
)
|
||||||
self.startbutton.pack(side="right")
|
self.startbutton.pack(side="right")
|
||||||
|
|
||||||
startserverbutton = customtkinter.CTkButton(
|
# startserverbutton = customtkinter.CTkButton(
|
||||||
fileframe, text="Start Server", command=self.start_server
|
# fileframe, text="Start Server", command=self.start_server
|
||||||
)
|
# )
|
||||||
startserverbutton.pack(side="right")
|
# startserverbutton.pack(side="right")
|
||||||
|
|
||||||
open_web_button = customtkinter.CTkButton(
|
open_web_button = customtkinter.CTkButton(
|
||||||
fileframe, text="Open Web", command=self.open_web
|
fileframe, text="Open Web", command=self.open_web
|
||||||
|
|
|
@ -18,7 +18,8 @@ class FilesSource(FileBasedSource):
|
||||||
|
|
||||||
source_name = "files"
|
source_name = "files"
|
||||||
config_schema = FileBasedSource.config_schema | {
|
config_schema = FileBasedSource.config_schema | {
|
||||||
"dir": (str, "Directory to index", ".")
|
"dir": (str, "Directory to index", "."),
|
||||||
|
"index_file": (str, "Index file", "files-index"),
|
||||||
}
|
}
|
||||||
|
|
||||||
def __init__(self, config: dict[str, Any]):
|
def __init__(self, config: dict[str, Any]):
|
||||||
|
|
|
@ -41,6 +41,7 @@ class S3Source(FileBasedSource):
|
||||||
"secure": (bool, "Use SSL", True),
|
"secure": (bool, "Use SSL", True),
|
||||||
"bucket": (str, "Bucket of the s3", ""),
|
"bucket": (str, "Bucket of the s3", ""),
|
||||||
"tmp_dir": (str, "Folder for\ntemporary download", "/tmp/syng"),
|
"tmp_dir": (str, "Folder for\ntemporary download", "/tmp/syng"),
|
||||||
|
"index_file": (str, "Index file", "s3-index"),
|
||||||
}
|
}
|
||||||
|
|
||||||
def __init__(self, config: dict[str, Any]):
|
def __init__(self, config: dict[str, Any]):
|
||||||
|
|
Loading…
Add table
Reference in a new issue