Skip to content

Bulk asynchronous downloader for multiple file hosts

Remove urls&password, add download_all_configs

Jules-WinnfieldX83c4635e527e
diff --git a/cyberdrop_dl/managers/args_manager.py b/cyberdrop_dl/managers/args_manager.py
index 92906fdc2..cc332e50c 100644
--- a/cyberdrop_dl/managers/args_manager.py
+++ b/cyberdrop_dl/managers/args_manager.py
@@ -7,6 +7,7 @@ class ArgsManager:
def __init__(self):
self.parsed_args = {}
+ self.all_configs = False
self.immediate_download = False
self.load_config_from_args = False
self.load_config_name = ""
@@ -18,7 +19,9 @@ class ArgsManager:
self.parsed_args = parse_args().__dict__
self.immediate_download = self.parsed_args['download']
+ self.all_configs = self.parsed_args['download_all_configs']
self.load_config_name = self.parsed_args['config']
+
if self.load_config_name:
self.load_config_from_args = True
self.portable = self.parsed_args['portable']
@@ -26,6 +29,7 @@ class ArgsManager:
self.other_links = self.parsed_args['links']
del self.parsed_args['download']
+ del self.parsed_args['download_all_configs']
del self.parsed_args['config']
del self.parsed_args['portable']
del self.parsed_args['links']
diff --git a/cyberdrop_dl/managers/file_manager.py b/cyberdrop_dl/managers/file_manager.py
index 1308ed8de..41ecf99cd 100644
--- a/cyberdrop_dl/managers/file_manager.py
+++ b/cyberdrop_dl/managers/file_manager.py
@@ -8,8 +8,6 @@ if TYPE_CHECKING:
class FileManager:
def __init__(self):
self.input_file: Path = field(init=False)
- self.input_password_file: Path = field(init=False)
-
self.history_db: Path = field(init=False)
self.main_log: Path = field(init=False)
@@ -21,7 +19,6 @@ class FileManager:
def startup(self) -> None:
"""Startup process for the file manager"""
self.input_file.touch(exist_ok=True)
- self.input_password_file.touch(exist_ok=True)
self.main_log.touch(exist_ok=True)
self.last_post_log.touch(exist_ok=True)
diff --git a/cyberdrop_dl/ui/prompts/general_prompts.py b/cyberdrop_dl/ui/prompts/general_prompts.py
index ef2bcdbfb..afe7c9348 100644
--- a/cyberdrop_dl/ui/prompts/general_prompts.py
+++ b/cyberdrop_dl/ui/prompts/general_prompts.py
@@ -27,8 +27,8 @@ def main_prompt(manager: Manager) -> int:
message="What would you like to do?",
choices=[
Choice(1, "Download"),
- Choice(2, "Edit URLs File"),
- Choice(3, "Edit URLs & Passwords File"),
+ Choice(2, "Download (All Configs)"),
+ Choice(3, "Edit URLs File"),
Separator(),
Choice(4, f"Select Config (Current: {manager.config_manager.loaded_config})"),
Choice(5, "Manage Configs"),
diff --git a/cyberdrop_dl/ui/prompts/url_file_prompts.py b/cyberdrop_dl/ui/prompts/url_file_prompts.py
index 71c01f840..af89097f1 100644
--- a/cyberdrop_dl/ui/prompts/url_file_prompts.py
+++ b/cyberdrop_dl/ui/prompts/url_file_prompts.py
@@ -26,32 +26,3 @@ def edit_urls_prompt(URLs_File: Path, fix_strings=True) -> None:
with open(URLs_File, "w") as f:
f.write(result)
-
-
-def edit_urls_passwords_prompt(URLs_File: Path) -> None:
- """Edit the URLs & Passwords file"""
- while True:
- console.clear()
- console.print(f"Editing URLs & Passwords: {URLs_File}")
- action = inquirer.select(
- message="What would you like to do?",
- choices=[
- Choice(1, "Add New Links"),
- Choice(2, "Clear All Links"),
- Choice(3, "Edit URLs & Passwords"),
- Choice(4, "Done"),
- ],
- ).execute()
-
- if action == 1:
- url = inquirer.text(message="Enter the URL:").execute()
- password = inquirer.text(message="Enter the password:").execute()
- with open(URLs_File, "a") as f:
- f.write(f"\n{url} : {password}\n")
- elif action == 2:
- URLs_File.unlink(missing_ok=True)
- URLs_File.touch()
- elif action == 3:
- edit_urls_prompt(URLs_File, fix_strings=False)
- elif action == 4:
- return
diff --git a/cyberdrop_dl/ui/ui.py b/cyberdrop_dl/ui/ui.py
index 300f269f6..aa2a4215a 100644
--- a/cyberdrop_dl/ui/ui.py
+++ b/cyberdrop_dl/ui/ui.py
@@ -32,8 +32,12 @@ def program_ui(manager: Manager):
if action == 1:
break
+ if action == 2:
+ manager.args_manager.all_configs = True
+ break
+
# Edit URLs
- elif action == 2:
+ elif action == 3:
edit_urls_prompt(manager.file_manager.input_file)
# Edit URLs & Passwords
diff --git a/cyberdrop_dl/utils/args/args.py b/cyberdrop_dl/utils/args/args.py
index 2ca06b185..56671a70b 100644
--- a/cyberdrop_dl/utils/args/args.py
+++ b/cyberdrop_dl/utils/args/args.py
@@ -12,6 +12,7 @@ def parse_args() -> argparse.Namespace:
general.add_argument("--config", type=str, help="name of config to load", default="")
general.add_argument("--portable", action="store_true", help="use portable mode", default=False)
general.add_argument("--download", action="store_true", help="Skip the UI and go straight to downloading", default=False)
+ general.add_argument("--download-all-configs", action="store_true", help="Skip the UI and iterate through configs", default=False)
# Settings
download_options = parser.add_argument_group("Download_Options")
diff --git a/cyberdrop_dl/utils/args/config_definitions.py b/cyberdrop_dl/utils/args/config_definitions.py
index 9ed55d813..da941bfeb 100644
--- a/cyberdrop_dl/utils/args/config_definitions.py
+++ b/cyberdrop_dl/utils/args/config_definitions.py
@@ -52,7 +52,6 @@ settings: Dict = {
},
"Files": {
"input_file": str(APP_STORAGE / "Configs" / "Default" / "URLs.txt"),
- "input_password_file": str(APP_STORAGE / "Configs" / "Default" / "URLs & Passwords.txt"),
"download_folder": str(DOWNLOAD_STORAGE / "Cyberdrop-DL Downloads"),
},
"Logs": {
diff --git a/cyberdrop_dl/utils/dataclasses/url_objects.py b/cyberdrop_dl/utils/dataclasses/url_objects.py
index ad11205d4..4172cbfac 100644
--- a/cyberdrop_dl/utils/dataclasses/url_objects.py
+++ b/cyberdrop_dl/utils/dataclasses/url_objects.py
@@ -22,10 +22,7 @@ class MediaItem:
class ScrapeItem:
- def __init__(self, url: URL, parent_title: str, part_of_album: bool = False, password: str = None):
+ def __init__(self, url: URL, parent_title: str, part_of_album: bool = False):
self.url: URL = url
self.parent_title: str = parent_title
self.part_of_album: bool = part_of_album
- self.password: str = field(init=False)
- if password:
- self.password: str = password