From 8e31964209cc689c39cb323babc095a1e228a330 Mon Sep 17 00:00:00 2001 From: Jules-WinnfieldX Date: Fri, 19 Apr 2024 13:10:27 -0600 Subject: [PATCH] add sort all configs option --- cyberdrop_dl/__init__.py | 2 +- cyberdrop_dl/main.py | 21 +++++++++++---------- cyberdrop_dl/managers/args_manager.py | 1 + cyberdrop_dl/ui/prompts/general_prompts.py | 15 ++++++++------- cyberdrop_dl/ui/ui.py | 20 +++++++++++++------- pyproject.toml | 2 +- 6 files changed, 35 insertions(+), 26 deletions(-) diff --git a/cyberdrop_dl/__init__.py b/cyberdrop_dl/__init__.py index 2a201abce..370e4fa33 100644 --- a/cyberdrop_dl/__init__.py +++ b/cyberdrop_dl/__init__.py @@ -1 +1 @@ -__version__ = "5.2.38" +__version__ = "5.2.39" diff --git a/cyberdrop_dl/main.py b/cyberdrop_dl/main.py index a6b5f299b..dc3a660ff 100644 --- a/cyberdrop_dl/main.py +++ b/cyberdrop_dl/main.py @@ -103,17 +103,18 @@ async def director(manager: Manager) -> None: await manager.async_startup() await log("Starting UI...", 20) - try: - if not manager.args_manager.no_ui: - with Live(manager.progress_manager.layout, refresh_per_second=manager.config_manager.settings_data['Runtime_Options']['ui_refresh_rate']): + if not manager.args_manager.sort_all_configs: + try: + if not manager.args_manager.no_ui: + with Live(manager.progress_manager.layout, refresh_per_second=manager.config_manager.settings_data['Runtime_Options']['ui_refresh_rate']): + await runtime(manager) + else: await runtime(manager) - else: - await runtime(manager) - except Exception as e: - print("\nAn error occurred, please report this to the developer") - print(e) - print(traceback.format_exc()) - exit(1) + except Exception as e: + print("\nAn error occurred, please report this to the developer") + print(e) + print(traceback.format_exc()) + exit(1) clear_screen_proc = await asyncio.create_subprocess_shell('cls' if os.name == 'nt' else 'clear') await clear_screen_proc.wait() diff --git a/cyberdrop_dl/managers/args_manager.py b/cyberdrop_dl/managers/args_manager.py index c1b339f5b..737791eec 100644 --- a/cyberdrop_dl/managers/args_manager.py +++ b/cyberdrop_dl/managers/args_manager.py @@ -14,6 +14,7 @@ def __init__(self): self.flaresolverr = "" self.all_configs = False + self.sort_all_configs = False self.retry = False self.immediate_download = False diff --git a/cyberdrop_dl/ui/prompts/general_prompts.py b/cyberdrop_dl/ui/prompts/general_prompts.py index 5a1d6a2d9..41e61b8ad 100644 --- a/cyberdrop_dl/ui/prompts/general_prompts.py +++ b/cyberdrop_dl/ui/prompts/general_prompts.py @@ -29,15 +29,16 @@ def main_prompt(manager: Manager) -> int: Choice(1, "Download"), Choice(2, "Download (All Configs)"), Choice(3, "Retry Failed Downloads"), - Choice(4, "Edit URLs File"), + Choice(4, "Sort All Configs"), + Choice(5, "Edit URLs File"), Separator(), - Choice(5, f"Select Config (Current: {manager.config_manager.loaded_config})"), - Choice(6, "Change URLs.txt file and Download Location"), - Choice(7, "Manage Configs"), + Choice(6, f"Select Config (Current: {manager.config_manager.loaded_config})"), + Choice(7, "Change URLs.txt file and Download Location"), + Choice(8, "Manage Configs"), Separator(), - Choice(8, "Import Cyberdrop_V4 Items"), - Choice(9, "Donate"), - Choice(10, "Exit"), + Choice(9, "Import Cyberdrop_V4 Items"), + Choice(10, "Donate"), + Choice(11, "Exit"), ], long_instruction="ARROW KEYS: Navigate | ENTER: Select", vi_mode=manager.vi_mode, ).execute() diff --git a/cyberdrop_dl/ui/ui.py b/cyberdrop_dl/ui/ui.py index 2714f7127..54dea50b7 100644 --- a/cyberdrop_dl/ui/ui.py +++ b/cyberdrop_dl/ui/ui.py @@ -46,19 +46,25 @@ def program_ui(manager: Manager): elif action == 3: manager.args_manager.retry = True break + + # Sort All Configs + elif action == 4: + manager.args_manager.sort_all_configs = True + manager.args_manager.all_configs = True + break # Edit URLs - elif action == 4: + elif action == 5: input_file = manager.config_manager.settings_data['Files']['input_file'] if not manager.args_manager.input_file else manager.args_manager.input_file edit_urls_prompt(input_file, manager.vi_mode) # Select Config - elif action == 5: + elif action == 6: configs = manager.config_manager.get_configs() selected_config = select_config_prompt(manager, configs) manager.config_manager.change_config(selected_config) - elif action == 6: + elif action == 7: console.clear() console.print("Editing Input / Output File Paths") input_file = inquirer.filepath( @@ -79,7 +85,7 @@ def program_ui(manager: Manager): manager.config_manager.write_updated_settings_config() # Manage Configs - elif action == 7: + elif action == 8: while True: console.clear() console.print("[bold]Manage Configs[/bold]") @@ -134,13 +140,13 @@ def program_ui(manager: Manager): break # Import Cyberdrop_V4 Items - elif action == 8: + elif action == 9: import_cyberdrop_v4_items_prompt(manager) # Donate - elif action == 9: + elif action == 10: donations_prompt(manager) # Exit - elif action == 10: + elif action == 11: exit(0) diff --git a/pyproject.toml b/pyproject.toml index 06a0cc58c..b51d2fad6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "cyberdrop-dl" -version = "5.2.38" +version = "5.2.39" description = "Bulk downloader for multiple file hosts" authors = ["Jules Winnfield "] readme = "README.md"