Bulk asynchronous downloader for multiple file hosts
Python asynciobunkrcyberdropdownloaderdropboxfilestergofilegoogle-drivemediafiremegamega-nzonedrivepatreonpawchivepinterestpixeldraintransfer-ittwitchtwittervk
refactor: UI style improvements
NTFSvolume1ad9aae47570
diff --git a/cyberdrop_dl/progress/__init__.py b/cyberdrop_dl/progress/__init__.pyindex b3ec0932b..80afef018 100644--- a/cyberdrop_dl/progress/__init__.py+++ b/cyberdrop_dl/progress/__init__.py@@ -5,6 +5,7 @@ from typing import TYPE_CHECKINGfrom rich.live import Livefrom rich.markup import escapefrom rich.progress import Progress, Task, TaskID+from rich.text import Textif TYPE_CHECKING:from pathlib import Path@@ -21,9 +22,9 @@ def create_live(renderable: RenderableType) -> Live:)-def hyperlink(file_path: Path, text: str | None = None) -> str:+def hyperlink(file_path: Path, text: str | None = None) -> Text:text = escape(text or str(file_path))- return f"[blue][link={file_path.as_uri()}]{text}[/link][/blue]"+ return Text.from_markup(f"[link={file_path.as_uri()}]{text}[/link]", style="blue")class DictProgress(Progress):diff --git a/cyberdrop_dl/progress/sorting.py b/cyberdrop_dl/progress/sorting.pyindex 1f930ad2f..7134da43a 100644--- a/cyberdrop_dl/progress/sorting.py+++ b/cyberdrop_dl/progress/sorting.py@@ -54,7 +54,7 @@ class SortingUI:self._tasks_map[name] = self._progress.add_task(f"[{color}] {name.capitalize()} :{emoji}: ", total=None)def file_row(name: str, file: Path) -> Text:- return Text.assemble((f"{name}: ", "green"), Text.from_markup(hyperlink(file)))+ return Text.assemble((f"{name}: ", "green"), hyperlink(file))self._total: int = 0diff --git a/cyberdrop_dl/ui/program_ui.py b/cyberdrop_dl/ui/program_ui.pyindex 479f6c54c..3d091b5da 100644--- a/cyberdrop_dl/ui/program_ui.py+++ b/cyberdrop_dl/ui/program_ui.py@@ -29,6 +29,7 @@ if TYPE_CHECKING:_CONSOLE = Console()_ERROR = Text("ERROR: ", style="bold red")+_WARNING = Text("WARNING: ", style="bold yellow")_CHANGELOG_URL = "https://raw.githubusercontent.com/NTFSvolume/cdl/refs/heads/main/CHANGELOG.md"_changelog: str = ""@@ -74,9 +75,10 @@ class ProgramUI:def _sort_files(self) -> None:sorter = Sorter.from_manager(self.manager)_CONSOLE.print(- f"You are about to sort files from '{sorter.input_dir}' to '{sorter.output_dir}'", style="bold red"+ _WARNING,+ f"You are about to sort files from '{sorter.input_dir}' to '{sorter.output_dir}'",)- answer = input("Type 'YES' to proceed")+ answer = _ask_text("Type 'YES' to proceed")if answer.strip().casefold() == "yes":asyncio.run(sorter.run())_enter_to_continue()@@ -122,7 +124,11 @@ def _view_changelog() -> None:def _app_header(manager: Manager) -> None:_clear_term()_CONSOLE.print(f"[bold]cyberdrop-dl ([blue]v{__version__!s}[/blue])[/bold]")- _CONSOLE.print(f"config file: [blue]{hyperlink(manager.config_manager.settings)}[/blue]\n")+ _CONSOLE.rule(style="blue")+ _CONSOLE.print("Config file: ", hyperlink(manager.config_manager.settings))+ _CONSOLE.print("Database file:", hyperlink(manager.appdata.db_file))+ _CONSOLE.print("URLs file: ", hyperlink(manager.config.files.input_file))+ _CONSOLE.line()def _ask_choices(choices: Iterable[str]) -> str:@@ -145,6 +151,10 @@ def _ask(question: inquirer.questions.Question) -> str:return next(iter(answers.values()))+def _ask_text(text: str) -> str:+ return _ask(inquirer.Text("text", message=text))++def _ask_dir(message: str = "Select dir path", default: Path = Path.home()) -> Path: # noqa: B008while True:try: