diff --git a/.vscode/settings.json b/.vscode/settings.json index 289067c3..3875a991 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -76,6 +76,7 @@ "socketio", "timespec", "tmpfilename", + "ungroup", "upgrader", "urandom", "urlsafe", diff --git a/app/library/DownloadQueue.py b/app/library/DownloadQueue.py index ff5cb171..cb27f098 100644 --- a/app/library/DownloadQueue.py +++ b/app/library/DownloadQueue.py @@ -360,7 +360,7 @@ class DownloadQueue(metaclass=Singleton): starts_in.replace(tzinfo=UTC) if starts_in.tzinfo is None else starts_in.astimezone(UTC) ) starts_in = starts_in + timedelta(minutes=5, seconds=dl.extras.get("duration", 0)) - dlInfo.info.error += f" Download will start at {starts_in.isoformat()}." + dlInfo.info.error += f" Download will start at {starts_in.astimezone().isoformat()}." _requeue = False except Exception as e: LOG.error(f"Failed to parse live_in date '{release_in}'. {e!s}") @@ -917,7 +917,7 @@ class DownloadQueue(metaclass=Singleton): premiere_ends: datetime = starts_in + timedelta(minutes=5, seconds=duration) if time_now < premiere_ends: LOG.debug( - f"Item '{item_ref}' is premiering, download will start in '{(starts_in.astimezone() + timedelta(minutes=5, seconds=duration)).isoformat()}'" + f"Item '{item_ref}' is premiering, download will start in '{(starts_in + timedelta(minutes=5, seconds=duration)).astimezone().isoformat()}'" ) continue diff --git a/app/library/HttpAPI.py b/app/library/HttpAPI.py index d567809f..ab073695 100644 --- a/app/library/HttpAPI.py +++ b/app/library/HttpAPI.py @@ -44,7 +44,6 @@ class HttpAPI: "config": self.config, "notify": self._notify, "cache": self.cache, - "app": self.app, "http_api": self, "root_path": self.rootPath, }.items() diff --git a/app/library/Services.py b/app/library/Services.py index dabfa640..bf9d93cd 100644 --- a/app/library/Services.py +++ b/app/library/Services.py @@ -1,9 +1,11 @@ import inspect +import logging from typing import Any, TypeVar from app.library.Singleton import Singleton T = TypeVar("T") +LOG: logging.Logger = logging.getLogger(__name__) class Services(metaclass=Singleton): @@ -50,6 +52,10 @@ class Services(metaclass=Singleton): sig = inspect.signature(handler) expected_args = sig.parameters.keys() filtered = {k: v for k, v in context.items() if k in expected_args} + + if missing_args := expected_args - filtered.keys(): + LOG.error(f"Missing arguments for handler '{handler.__name__}': {missing_args}") + return await handler(**filtered) def handle_sync(self, handler: callable, **kwargs) -> Any: @@ -58,4 +64,8 @@ class Services(metaclass=Singleton): sig = inspect.signature(handler) expected_args = sig.parameters.keys() filtered = {k: v for k, v in context.items() if k in expected_args} + + if missing_args := expected_args - filtered.keys(): + LOG.error(f"Missing arguments for handler '{handler.__name__}': {missing_args}") + return handler(**filtered) diff --git a/app/library/Tasks.py b/app/library/Tasks.py index a20dfdb7..f439aea7 100644 --- a/app/library/Tasks.py +++ b/app/library/Tasks.py @@ -152,7 +152,7 @@ class Tasks(metaclass=Singleton): self._tasks.append(task) - if not task.timer: + if not task.timer or "[only_handler]" in task.name: continue try: diff --git a/app/main.py b/app/main.py index 42f91235..8152d024 100644 --- a/app/main.py +++ b/app/main.py @@ -25,6 +25,7 @@ from app.library.HttpSocket import HttpSocket from app.library.Notifications import Notification from app.library.Presets import Presets from app.library.Scheduler import Scheduler +from app.library.Services import Services from app.library.Tasks import Tasks LOG = logging.getLogger("app") @@ -38,6 +39,8 @@ class Main: self._config = Config.get_instance(is_native=is_native) self._app = web.Application() + Services.get_instance().add("app", self._app) + if self._config.debug: loop = asyncio.get_event_loop() loop.set_debug(True) diff --git a/ui/assets/css/style.css b/ui/assets/css/style.css index fb8781d3..83fa61ca 100644 --- a/ui/assets/css/style.css +++ b/ui/assets/css/style.css @@ -332,3 +332,7 @@ hr { .is-bold { font-weight: bold; } + +.fa-spin-10 { + --fa-animation-iteration-count: 10; +} diff --git a/ui/components/History.vue b/ui/components/History.vue index 88508196..0aecc6ee 100644 --- a/ui/components/History.vue +++ b/ui/components/History.vue @@ -22,17 +22,16 @@ -