From cd29cc4b399e26bb6b09211ab0dc2956f78c79c4 Mon Sep 17 00:00:00 2001 From: Jules-WinnfieldX Date: Mon, 4 Dec 2023 12:39:46 -0700 Subject: [PATCH] add change url and download on base ui because people are stupid. --- cyberdrop_dl/__init__.py | 2 +- cyberdrop_dl/ui/prompts/general_prompts.py | 9 ++++---- cyberdrop_dl/ui/ui.py | 27 ++++++++++++++++++---- pyproject.toml | 2 +- 4 files changed, 30 insertions(+), 10 deletions(-) diff --git a/cyberdrop_dl/__init__.py b/cyberdrop_dl/__init__.py index 66462ced9..0816aa17a 100644 --- a/cyberdrop_dl/__init__.py +++ b/cyberdrop_dl/__init__.py @@ -1 +1 @@ -__version__ = "5.0.21" +__version__ = "5.0.22" diff --git a/cyberdrop_dl/ui/prompts/general_prompts.py b/cyberdrop_dl/ui/prompts/general_prompts.py index b0ddbed14..ba87e0c03 100644 --- a/cyberdrop_dl/ui/prompts/general_prompts.py +++ b/cyberdrop_dl/ui/prompts/general_prompts.py @@ -32,11 +32,12 @@ def main_prompt(manager: Manager) -> int: Choice(4, "Edit URLs File"), Separator(), Choice(5, f"Select Config (Current: {manager.config_manager.loaded_config})"), - Choice(6, "Manage Configs"), + Choice(6, "Change URLs.txt file and Download Location"), + Choice(7, "Manage Configs"), Separator(), - Choice(7, "Import Cyberdrop_V4 Items"), - Choice(8, "Donate"), - Choice(9, "Exit"), + Choice(8, "Import Cyberdrop_V4 Items"), + Choice(9, "Donate"), + Choice(10, "Exit"), ], long_instruction="ARROW KEYS: Navigate | ENTER: Select", ).execute() diff --git a/cyberdrop_dl/ui/ui.py b/cyberdrop_dl/ui/ui.py index c4760e78e..9fc4f033d 100644 --- a/cyberdrop_dl/ui/ui.py +++ b/cyberdrop_dl/ui/ui.py @@ -1,8 +1,10 @@ from __future__ import annotations +from pathlib import Path from typing import TYPE_CHECKING from InquirerPy import inquirer +from InquirerPy.validator import PathValidator from rich.console import Console from cyberdrop_dl import __version__ @@ -53,8 +55,25 @@ def program_ui(manager: Manager): selected_config = select_config_prompt(configs) manager.config_manager.change_config(selected_config) - # Manage Configs elif action == 6: + console.clear() + console.print("Editing Input / Output File Paths") + input_file = inquirer.filepath( + message="Enter the input file path:", + default=str(manager.config_manager.settings_data['Files']['input_file']), + validate=PathValidator(is_file=True, message="Input is not a file") + ).execute() + download_folder = inquirer.text( + message="Enter the download folder path:", + default=str(manager.config_manager.settings_data['Files']['download_folder']), + validate=PathValidator(is_dir=True, message="Input is not a directory") + ).execute() + + manager.config_manager.settings_data['Files']['input_file'] = Path(input_file) + manager.config_manager.settings_data['Files']['download_folder'] = Path(download_folder) + + # Manage Configs + elif action == 7: while True: console.clear() console.print("[bold]Manage Configs[/bold]") @@ -107,13 +126,13 @@ def program_ui(manager: Manager): break # Import Cyberdrop_V4 Items - elif action == 7: + elif action == 8: import_cyberdrop_v4_items_prompt(manager) # Donate - elif action == 8: + elif action == 9: donations_prompt() # Exit - elif action == 9: + elif action == 10: exit(0) diff --git a/pyproject.toml b/pyproject.toml index cd4025992..6f95b0c2d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "cyberdrop-dl" -version = "5.0.21" +version = "5.0.22" description = "Bulk downloader for multiple file hosts" authors = ["Jules Winnfield "] readme = "README.md"