Skip to content

Bulk asynchronous downloader for multiple file hosts

fix: CLI args json seriable

NTFSvolumeb074891ddf72
diff --git a/cyberdrop_dl/commands/__init__.py b/cyberdrop_dl/commands/__init__.py
index 8c20eb969..e641cc4f7 100644
--- a/cyberdrop_dl/commands/__init__.py
+++ b/cyberdrop_dl/commands/__init__.py
@@ -1,7 +1,7 @@
import dataclasses
from collections.abc import Sequence
from pathlib import Path
-from typing import Annotated
+from typing import Annotated, Any
from cyclopts import Parameter, Token, validators
@@ -35,3 +35,8 @@ class CLIarguments:
database_file: SQLiteFile | None = None
"SQLite file to use as database"
+
+ def __json__(self) -> dict[str, Any]:
+ me: dict[str, Any] = {k: None if v is None else str(v) for k, v in dataclasses.asdict(self).items()}
+ me["urls"] = tuple(map(str, self.urls))
+ return me
diff --git a/cyberdrop_dl/commands/scrape.py b/cyberdrop_dl/commands/scrape.py
index 3a7f34219..76f88e81d 100644
--- a/cyberdrop_dl/commands/scrape.py
+++ b/cyberdrop_dl/commands/scrape.py
@@ -1,6 +1,7 @@
from __future__ import annotations
import logging
+from pathlib import Path # noqa: TC003
from typing import TYPE_CHECKING, Annotated
import cyclopts.validators
@@ -20,8 +21,6 @@ from cyberdrop_dl.utils import cleanup
logger = logging.getLogger(__name__)
if TYPE_CHECKING:
- from pathlib import Path
-
from cyclopts.argument import ArgumentCollection
from cyberdrop_dl.manager import Manager
diff --git a/cyberdrop_dl/manager.py b/cyberdrop_dl/manager.py
index e3601beff..230b5a606 100644
--- a/cyberdrop_dl/manager.py
+++ b/cyberdrop_dl/manager.py
@@ -118,7 +118,7 @@ class Manager:
def log_config_settings(self) -> None:
logger.info(f"Running cyberdrop-dl v{__version__}")
_log_enviroment()
- _log_cli_args(self.cli_args)
+ logger.debug({"CLI options": self.cli_args.__json__()})
_log_config(self.config)
_log_ffmpeg()
_log_database(self.appdata.db_file)
@@ -228,10 +228,6 @@ def _log_enviroment() -> None:
)
-def _log_cli_args(cli_args: CLIarguments) -> None:
- logger.debug({"CLI options": cli_args.model_dump(mode="json")})
-
-
def _log_config(config: Config) -> None:
logger.debug("Config file: %s", config.source)
logger.debug("Auth: \n%s", config.auth.censored_dump())