aboutsummaryrefslogtreecommitdiff
path: root/app/ui/hub.py
diff options
context:
space:
mode:
Diffstat (limited to 'app/ui/hub.py')
-rw-r--r--app/ui/hub.py16
1 files changed, 12 insertions, 4 deletions
diff --git a/app/ui/hub.py b/app/ui/hub.py
index c1f5dce..9282fa7 100644
--- a/app/ui/hub.py
+++ b/app/ui/hub.py
@@ -1405,15 +1405,24 @@ def _prepare_run_config(backend: str, kwargs: dict
if info is not None:
label = info.label
log_path = str(LOGS_FOLDER / f"audiobook_{datetime.now():%Y%m%d}.log")
+ # The run view points failures at this file, so make sure it exists
+ # from the moment a run starts — even when the run dies before the
+ # converter's setup_logging creates it.
+ LOGS_FOLDER.mkdir(parents=True, exist_ok=True)
+ Path(log_path).touch()
autostart = kwargs.pop("autostart", None)
+ # book_files/planned travel on the dedicated RunConfig fields; keeping
+ # them in kwargs too would collide with convert()'s named parameters.
+ book_files = kwargs.pop("book_files", None) or []
+ planned = kwargs.pop("planned", None) or []
api_url = kwargs.get("api_url")
if api_url:
identity = _remote_identity(backend, kwargs)
return runview.RunConfig(
backend=backend, backend_label=f"{label} [remote]",
- kwargs=kwargs, book_files=kwargs.get("book_files") or [],
- planned=kwargs.get("planned") or [],
+ kwargs=kwargs, book_files=book_files,
+ planned=planned,
server_url=api_url, server_identity=identity,
log_path=log_path)
@@ -1434,8 +1443,7 @@ def _prepare_run_config(backend: str, kwargs: dict
notice = (f"no server named '{autostart}' — starting it was skipped")
return runview.RunConfig(
backend=backend, backend_label=label, kwargs=kwargs,
- book_files=kwargs.get("book_files") or [],
- planned=kwargs.get("planned") or [],
+ book_files=book_files, planned=planned,
server_name=spec.name if spec is not None else None,
server_url=spec.url if spec is not None else None,
server_identity=spec.identity if spec is not None else None,