Implemented GUI for syng #2
3 changed files with 8 additions and 7 deletions
|
@ -25,6 +25,7 @@ yt-dlp = "*"
|
||||||
customtkinter = "^5.2.1"
|
customtkinter = "^5.2.1"
|
||||||
qrcode = "^7.4.2"
|
qrcode = "^7.4.2"
|
||||||
pymediainfo = "^6.1.0"
|
pymediainfo = "^6.1.0"
|
||||||
|
pyyaml = "^6.0.1"
|
||||||
|
|
||||||
[build-system]
|
[build-system]
|
||||||
requires = ["poetry-core"]
|
requires = ["poetry-core"]
|
||||||
|
|
|
@ -39,7 +39,7 @@ import tempfile
|
||||||
from argparse import ArgumentParser
|
from argparse import ArgumentParser
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
from dataclasses import field
|
from dataclasses import field
|
||||||
from json import load
|
from yaml import load, Loader
|
||||||
from traceback import print_exc
|
from traceback import print_exc
|
||||||
from typing import Any
|
from typing import Any
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
@ -385,7 +385,7 @@ async def start_client(config: dict[str, Any]) -> None:
|
||||||
if "config" in config:
|
if "config" in config:
|
||||||
last_song = (
|
last_song = (
|
||||||
datetime.datetime.fromisoformat(config["config"]["last_song"])
|
datetime.datetime.fromisoformat(config["config"]["last_song"])
|
||||||
if "last_song" in config["config"]
|
if "last_song" in config["config"] and config["config"]["last_song"]
|
||||||
else None
|
else None
|
||||||
)
|
)
|
||||||
state.config |= config["config"] | {"last_song": last_song}
|
state.config |= config["config"] | {"last_song": last_song}
|
||||||
|
@ -423,14 +423,14 @@ def main() -> None:
|
||||||
|
|
||||||
parser.add_argument("--room", "-r")
|
parser.add_argument("--room", "-r")
|
||||||
parser.add_argument("--secret", "-s")
|
parser.add_argument("--secret", "-s")
|
||||||
parser.add_argument("--config-file", "-C", default="syng-client.json")
|
parser.add_argument("--config-file", "-C", default="syng-client.yaml")
|
||||||
parser.add_argument("--key", "-k", default=None)
|
parser.add_argument("--key", "-k", default=None)
|
||||||
parser.add_argument("--server", "-S")
|
parser.add_argument("--server", "-S")
|
||||||
|
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
with open(args.config_file, encoding="utf8") as file:
|
with open(args.config_file, encoding="utf8") as file:
|
||||||
config = load(file)
|
config = load(file, Loader=Loader)
|
||||||
|
|
||||||
if "config" not in config:
|
if "config" not in config:
|
||||||
config["config"] = {}
|
config["config"] = {}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import builtins
|
import builtins
|
||||||
from json import load
|
from yaml import load, Loader
|
||||||
import customtkinter
|
import customtkinter
|
||||||
import qrcode
|
import qrcode
|
||||||
import secrets
|
import secrets
|
||||||
|
@ -164,8 +164,8 @@ class SyngGui(customtkinter.CTk):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super().__init__(className="Syng")
|
super().__init__(className="Syng")
|
||||||
|
|
||||||
with open("syng-client.json") as cfile:
|
with open("syng-client.yaml") as cfile:
|
||||||
loaded_config = load(cfile)
|
loaded_config = load(cfile, Loader=Loader)
|
||||||
config = {"sources": {}, "config": default_config()}
|
config = {"sources": {}, "config": default_config()}
|
||||||
if "config" in loaded_config:
|
if "config" in loaded_config:
|
||||||
config["config"] |= loaded_config["config"]
|
config["config"] |= loaded_config["config"]
|
||||||
|
|
Loading…
Add table
Reference in a new issue