Compare commits

..

2 Commits

Author SHA1 Message Date
Vxrtrauter bd26f073e4 fix config issues (fallback values, prevent errors) 2026-01-14 14:02:31 +01:00
Vxrtrauter 027b4aff8d improved debug & console outputs 2026-01-14 13:47:58 +01:00
2 changed files with 17 additions and 18 deletions
+11 -16
View File
@@ -34,22 +34,17 @@ def read_config():
if not os.path.exists(config_file): if not os.path.exists(config_file):
create_config() create_config()
return
config.read(config_file) config.read(config_file)
if state.debug is not None: state.debug = config.getboolean("General", "debug", fallback=state.debug)
state.debug = config.getboolean("General", "debug") state.api_url = config.get("General", "api_url", fallback=state.api_url)
if state.api_url is not None: state.aria2_threads = config.getint("General", "aria2_threads", fallback=state.aria2_threads)
state.api_url = config.get("General", "api_url") state.download_path = config.get("General", "download_path", fallback=state.download_path)
if state.aria2_threads is not None: state.speed_limit = config.getint("General", "speed_limit", fallback=state.speed_limit)
state.aria2_threads = config.getint("General", "aria2_threads") state.ignore_updates = config.getboolean("General", "ignore_updates", fallback=state.ignore_updates)
if state.download_path is not None: state.image_path = config.get("General", "image_path", fallback=state.image_path)
state.download_path = config.get("General", "download_path") state.autoresume = config.getboolean("General", "autoresume", fallback=state.autoresume)
if state.speed_limit is not None:
state.speed_limit = config.getint("General", "speed_limit") create_config()
if state.ignore_updates is not None:
state.ignore_updates = config.getboolean("General", "ignore_updates")
if state.image_path is not None:
state.image_path = config.get("General", "image_path")
if state.autoresume is not None:
state.autoresume = config.getboolean("General", "autoresume")
+6 -2
View File
@@ -1,6 +1,7 @@
from core.utils.data.models import Download, DownloadList from core.utils.data.models import Download, DownloadList
from core.utils.data.state import state from core.utils.data.state import state
from dataclasses import asdict from dataclasses import asdict
from datetime import datetime
import json import json
import os import os
import re import re
@@ -165,11 +166,14 @@ def set_main_window(window):
_main_window = window _main_window = window
def consoleLog(text): def consoleLog(text):
now = datetime.now()
current_time = now.strftime("%H:%M:%S")
try: try:
from core.interface.gui import MainWindow from core.interface.gui import MainWindow
MainWindow.add_log(text) MainWindow.add_log(f"[{current_time}] {text}")
except Exception: except Exception:
pass pass
if state.debug: if state.debug:
print(text) print(f"[{current_time}] {text}")