Skip to content
This repository has been archived by the owner on Jul 5, 2024. It is now read-only.

Commit

Permalink
add sort all configs option
Browse files Browse the repository at this point in the history
  • Loading branch information
Jules-WinnfieldX committed Apr 19, 2024
1 parent 7f69e0c commit 8e31964
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 26 deletions.
2 changes: 1 addition & 1 deletion cyberdrop_dl/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "5.2.38"
__version__ = "5.2.39"
21 changes: 11 additions & 10 deletions cyberdrop_dl/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
1 change: 1 addition & 0 deletions cyberdrop_dl/managers/args_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
15 changes: 8 additions & 7 deletions cyberdrop_dl/ui/prompts/general_prompts.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
20 changes: 13 additions & 7 deletions cyberdrop_dl/ui/ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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]")
Expand Down Expand Up @@ -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)
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -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 <[email protected]>"]
readme = "README.md"
Expand Down

0 comments on commit 8e31964

Please sign in to comment.