Bulk asynchronous downloader for multiple file hosts
Python asynciobunkrcyberdropdownloaderdropboxfilestergofilegoogle-drivemediafiremegamega-nzonedrivepatreonpawchivepinterestpixeldraintransfer-ittwitchtwittervk
refactor: prevent circular cli reference
NTFSvolume3686c0176fb7
diff --git a/cyberdrop_dl/cli/__init__.py b/cyberdrop_dl/cli/__init__.pyindex 236ea8a02..ddd2aed80 100644--- a/cyberdrop_dl/cli/__init__.py+++ b/cyberdrop_dl/cli/__init__.py@@ -1,28 +1,12 @@-from pathlib import Path-from typing import Annotated-from cyclopts import Parameterfrom cyclopts.core import Appfrom cyberdrop_dl import __version__-from cyberdrop_dl.models import ConfigModel-from cyberdrop_dl.models.types import HttpURL---@Parameter(name="*")-class CLIargs(ConfigModel):- links: Annotated[tuple[HttpURL, ...], Parameter(show=False)] = ()- "Link(s) to content to download (passing multiple links is supported"-- config_file: Path | None = None- "YAML file to use as config"-- cache_file: Path | None = None- "JSON file to use as cache"-- database_file: Path | None = None- "SQLite file to use as database"-+from cyberdrop_dl.cli.clean_up import app as cleanup+from cyberdrop_dl.cli.database import app as database+from cyberdrop_dl.cli.hash import compute_hashes+from cyberdrop_dl.cli.main import download, interactive+from cyberdrop_dl.cli.report import reportapp = App(name="cyberdrop-dl",@@ -33,6 +17,7 @@ app = App()def show() -> None:"""Show a list of all supported sites"""from cyberdrop_dl import supported_sites@@ -41,17 +26,8 @@ def show() -> None:app.console.print(table)-def register_commands() -> None:- from cyberdrop_dl.cli.clean_up import app as cleanup- from cyberdrop_dl.cli.database import app as database- from cyberdrop_dl.cli.hash import compute_hashes- from cyberdrop_dl.cli.main import download, interactive- from cyberdrop_dl.cli.report import report-- for cmd in download, database, interactive, show, cleanup, report:- app.command(cmd)-- app.command(compute_hashes, name="hash")+for cmd in download, database, interactive, cleanup, report:+ app.command(cmd)-register_commands()+app.command(compute_hashes, name="hash")diff --git a/cyberdrop_dl/cli/main.py b/cyberdrop_dl/cli/main.pyindex 56b015705..36fb48303 100644--- a/cyberdrop_dl/cli/main.py+++ b/cyberdrop_dl/cli/main.py@@ -9,13 +9,12 @@ import cyclopts.validatorsfrom cyclopts import Parameterfrom cyclopts.group import Group-from cyberdrop_dl.cli import CLIargsfrom cyberdrop_dl.cli.compat import check_for_v9_filesfrom cyberdrop_dl.config import Configfrom cyberdrop_dl.config.appdata import AppDatafrom cyberdrop_dl.exceptions import CDLConfigRuntimeErrorsGroupfrom cyberdrop_dl.logs import log_spacer, set_console_level, setup_file_logging-from cyberdrop_dl.models import merge_models+from cyberdrop_dl.models import ConfigModel, merge_modelsfrom cyberdrop_dl.models.types import HttpURL # noqa: TC001from cyberdrop_dl.utils import cleanup@@ -28,6 +27,21 @@ if TYPE_CHECKING:from cyberdrop_dl.manager import Manager+@Parameter(name="*")+class CLIargs(ConfigModel):+ links: Annotated[tuple[HttpURL, ...], Parameter(show=False)] = ()+ "Link(s) to content to download (passing multiple links is supported"++ config_file: Path | None = None+ "YAML file to use as config"++ cache_file: Path | None = None+ "JSON file to use as cache"++ database_file: Path | None = None+ "SQLite file to use as database"++async def _scrape(manager: Manager) -> None:from cyberdrop_dl import ffmpegfrom cyberdrop_dl.scrape_mapper import ScrapeMapperdiff --git a/cyberdrop_dl/manager.py b/cyberdrop_dl/manager.pyindex 42a3d9764..251b9c0d1 100644--- a/cyberdrop_dl/manager.py+++ b/cyberdrop_dl/manager.py@@ -29,7 +29,7 @@ from cyberdrop_dl.utils import enter_context, get_system_informationif TYPE_CHECKING:from collections.abc import Generator- from cyberdrop_dl.cli import CLIargs+ from cyberdrop_dl.cli.main import CLIargsfrom cyberdrop_dl.scrape_mapper import ScrapeMapper, ScrapeStatsfrom cyberdrop_dl.url_objects import MediaItem@@ -46,7 +46,7 @@ class Manager:config: Config | None = None,input_file: Path | None = None,) -> None:- from cyberdrop_dl.cli import CLIargs+ from cyberdrop_dl.cli.main import CLIargsself.cache: dict[str, Any] = {}self._appdata: AppData | None = appdata