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

Commit

Permalink
Add more CLI args.
Browse files Browse the repository at this point in the history
  • Loading branch information
Jules-WinnfieldX committed Apr 19, 2024
1 parent 49a98b5 commit 7f69e0c
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 8 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.37"
__version__ = "5.2.38"
10 changes: 9 additions & 1 deletion cyberdrop_dl/managers/args_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,13 @@ def __init__(self):
# Sorting
self.sort_downloads = field(init=False)
self.sort_folder = None

# Logs
self.main_log_filename = None
self.last_forum_post_filename = None
self.unsupported_urls_filename = None
self.download_error_urls_filename = None
self.scrape_error_urls_filename = None

def startup(self) -> None:
"""Parses arguments and sets variables accordingly"""
Expand Down Expand Up @@ -72,7 +79,6 @@ def startup(self) -> None:
self.immediate_download = True
if self.parsed_args['log_folder']:
self.log_dir = Path(self.parsed_args['log_folder'])

if self.parsed_args['sort_downloads']:
self.sort_downloads = True
if self.parsed_args['sort_folder']:
Expand All @@ -97,3 +103,5 @@ def startup(self) -> None:
del self.parsed_args['log_folder']
del self.parsed_args['proxy']
del self.parsed_args['links']
del self.parsed_args['sort_downloads']
del self.parsed_args['sort_folder']
15 changes: 10 additions & 5 deletions cyberdrop_dl/managers/path_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,16 @@ def startup(self) -> None:
self.input_file = self.manager.config_manager.settings_data['Files']['input_file'] if not self.manager.args_manager.input_file else self.manager.args_manager.input_file
self.history_db = self.cache_dir / "cyberdrop.db"

self.main_log = self.log_dir / self.manager.config_manager.settings_data['Logs']['main_log_filename']
self.last_post_log = self.log_dir / self.manager.config_manager.settings_data['Logs']['last_forum_post_filename']
self.unsupported_urls_log = self.log_dir / self.manager.config_manager.settings_data['Logs']['unsupported_urls_filename']
self.download_error_log = self.log_dir / self.manager.config_manager.settings_data['Logs']['download_error_urls_filename']
self.scrape_error_log = self.log_dir / self.manager.config_manager.settings_data['Logs']['scrape_error_urls_filename']
self.main_log = self.log_dir / (self.manager.config_manager.settings_data['Logs']['main_log_filename']
if not self.manager.args_manager.main_log_filename else self.manager.args_manager.main_log_filename)
self.last_post_log = self.log_dir / (self.manager.config_manager.settings_data['Logs']['last_forum_post_filename']
if not self.manager.args_manager.last_forum_post_filename else self.manager.args_manager.last_forum_post_filename)
self.unsupported_urls_log = self.log_dir / (self.manager.config_manager.settings_data['Logs']['unsupported_urls_filename']
if not self.manager.args_manager.unsupported_urls_filename else self.manager.args_manager.unsupported_urls_filename)
self.download_error_log = self.log_dir / (self.manager.config_manager.settings_data['Logs']['download_error_urls_filename']
if not self.manager.args_manager.download_error_urls_filename else self.manager.args_manager.download_error_urls_filename)
self.scrape_error_log = self.log_dir / (self.manager.config_manager.settings_data['Logs']['scrape_error_urls_filename']
if not self.manager.args_manager.scrape_error_urls_filename else self.manager.args_manager.scrape_error_urls_filename)

self.log_dir.mkdir(parents=True, exist_ok=True)
if not self.input_file.is_file():
Expand Down
7 changes: 7 additions & 0 deletions cyberdrop_dl/utils/args/args.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ def parse_args() -> argparse.Namespace:
file_paths.add_argument("--config-file", type=str, help="path to the CDL settings.yaml file to load", default="")
file_paths.add_argument("--appdata-folder", type=str, help="path to where you want CDL to store it's AppData folder", default="")
file_paths.add_argument("--log-folder", type=str, help="path to where you want CDL to store it's log files", default="")
file_paths.add_argument("--main-log-filename", type=str, help="filename for the main log file", default="")
file_paths.add_argument("--last-forum-post-filename", type=str, help="filename for the last forum post log file", default="")
file_paths.add_argument("--unsupported-urls-filename", type=str, help="filename for the unsupported urls log file", default="")
file_paths.add_argument("--download-error-urls-filename", type=str, help="filename for the download error urls log file", default="")
file_paths.add_argument("--scrape-error-urls-filename", type=str, help="filename for the scrape error urls log file", default="")

# Settings
download_options = parser.add_argument_group("Download_Options")
Expand All @@ -35,6 +40,8 @@ def parse_args() -> argparse.Namespace:
download_options.add_argument("--include-thread-id-in-folder-name", action="store_true", help="include thread id in folder name", default=False)
download_options.add_argument("--remove-domains-from-folder-names", action="store_true", help="remove website domains from folder names", default=False)
download_options.add_argument("--remove-generated-id-from-filenames", action="store_true", help="remove site generated id from filenames", default=False)
download_options.add_argument("--scrape-single-forum-post", action="store_true", help="scrape single forum post", default=False)
download_options.add_argument("--separate-posts", action="store_true", help="separate posts into folders", default=False)
download_options.add_argument("--skip-download-mark-completed", action="store_true", help="skip download and mark as completed in history", default=False)

file_size_limits = parser.add_argument_group("File_Size_Limits")
Expand Down
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.37"
version = "5.2.38"
description = "Bulk downloader for multiple file hosts"
authors = ["Jules Winnfield <[email protected]>"]
readme = "README.md"
Expand Down

0 comments on commit 7f69e0c

Please sign in to comment.