Bulk asynchronous downloader for multiple file hosts
Python asynciobunkrcyberdropdownloaderdropboxfilestergofilegoogle-drivemediafiremegamega-nzonedrivepatreonpawchivepinterestpixeldraintransfer-ittwitchtwittervk
Switch domain selection to fuzzy choices
Jacob92748f290803
diff --git a/cyberdrop_dl/ui/prompts/basic_prompts.py b/cyberdrop_dl/ui/prompts/basic_prompts.pyindex d97b6ae4d..f471015fb 100644--- a/cyberdrop_dl/ui/prompts/basic_prompts.py+++ b/cyberdrop_dl/ui/prompts/basic_prompts.py@@ -31,16 +31,22 @@ def ask_checkbox(choices: list[Choice], *, message: str = "Select multiple optioreturn inquirer.checkbox(message=message, choices=choices, **options).execute()-def ask_choice_fuzzy(message: str, choices: list[Choice], validate_empty: bool = True, **kwargs):+def ask_choice_fuzzy(choices: list[Choice], message: str, validate_empty: bool = True, **kwargs):options = (DEFAULT_OPTIONS| {"long_instruction": "ARROW KEYS: Navigate | TYPE: Filter | TAB: select, ENTER: Finish Selection"}| kwargs)+ custom_validate = options.pop("validate", None)+ validate = (+ EmptyInputValidator("Input should not be empty")+ if validate_empty and custom_validate is None+ else custom_validate+ )return inquirer.fuzzy(message=message,choices=choices,- validate=EmptyInputValidator("Input should not be empty") if validate_empty else None,+ validate=validate,**options,).execute()diff --git a/cyberdrop_dl/ui/prompts/user_prompts.py b/cyberdrop_dl/ui/prompts/user_prompts.pyindex a090b394b..2a15de77e 100644--- a/cyberdrop_dl/ui/prompts/user_prompts.py+++ b/cyberdrop_dl/ui/prompts/user_prompts.py@@ -6,6 +6,10 @@ from typing import TYPE_CHECKINGfrom InquirerPy import get_stylefrom InquirerPy.base.control import Choice+from InquirerPy.enum import (+ INQUIRERPY_EMPTY_CIRCLE_SEQUENCE,+ INQUIRERPY_FILL_CIRCLE_SEQUENCE,+)from rich.console import Consolefrom cyberdrop_dl import __version__@@ -93,8 +97,8 @@ def create_new_config(manager: Manager, *, title: str = "Create a new config fildef select_config(configs: list) -> str:"""Asks the user to select an existing config name."""return basic_prompts.ask_choice_fuzzy(- message="Select a config file:",choices=configs,+ message="Select a config file:",validate_empty=True,long_instruction="ARROW KEYS: Navigate | TYPE: Filter | TAB: select, ENTER: Finish Selection",invalid_message="Need to select a config.",@@ -145,7 +149,26 @@ def domains_prompt(*, domain_message: str = "Select site(s):") -> list[str]:all_domains = list(SUPPORTED_FORUMS.values() if domain_type == DomainType.FORUM else SUPPORTED_WEBSITES.values())domain_choices = [Choice(site) for site in all_domains] + [ALL_CHOICE]- domains = basic_prompts.ask_checkbox(domain_choices, message=domain_message)+ domains = basic_prompts.ask_choice_fuzzy(+ choices=domain_choices,+ message=domain_message,+ validate_empty=True,+ multiselect=True,+ marker_pl=f" {INQUIRERPY_EMPTY_CIRCLE_SEQUENCE} ",+ marker=f" {INQUIRERPY_FILL_CIRCLE_SEQUENCE} ",+ style=get_style(+ {+ "marker": "#98c379",+ "questionmark": "#e5c07b",+ "pointer": "#61afef",+ "long_instruction": "#abb2bf",+ "fuzzy_prompt": "#c678dd",+ "fuzzy_info": "#abb2bf",+ "fuzzy_border": "#4b5263",+ "fuzzy_match": "#c678dd",+ }+ ),+ )if ALL_CHOICE.value in domains:domains = all_domainsreturn domains, all_domains