Skip to content

Bulk asynchronous downloader for multiple file hosts

Add support for disabling partial search and empty_dir purge.

Jules-WinnfieldXff12347c5be9
diff --git a/cyberdrop_dl/base_functions/config_schema.py b/cyberdrop_dl/base_functions/config_schema.py
index 12296bb79..d82a9eb71 100644
--- a/cyberdrop_dl/base_functions/config_schema.py
+++ b/cyberdrop_dl/base_functions/config_schema.py
@@ -72,6 +72,7 @@ config_default: Dict = {
"allow_insecure_connections": False,
"attempts": 10,
"block_sub_folders": False,
+ "check_for_partial_files_and_empty_dirs": True,
"disable_attempt_limit": False,
"filesize_minimum_images": 0,
"filesize_minimum_other": 0,
diff --git a/cyberdrop_dl/main.py b/cyberdrop_dl/main.py
index 2bec78c3c..cf788fe1b 100644
--- a/cyberdrop_dl/main.py
+++ b/cyberdrop_dl/main.py
@@ -63,6 +63,7 @@ def parse_args() -> argparse.Namespace:
runtime_opts.add_argument("--allow-insecure-connections", help="allows insecure connections from content hosts", action="store_true")
runtime_opts.add_argument("--attempts", type=int, help="number of attempts to download each file (default: %(default)s)", default=config_group["attempts"])
runtime_opts.add_argument("--block-sub-folders", help="block sub folders from being created", action="store_true")
+ runtime_opts.add_argument("--check-for-partial-files-and-empty-dirs", type=bool, default=config_group["check_for_partial_files_and_empty_dirs"], help="checks for partial files and empty directories after completing (default: %(default)s)")
runtime_opts.add_argument("--disable-attempt-limit", help="disables the attempt limitation", action="store_true")
runtime_opts.add_argument("--filesize_maximum_images", type=int, default=config_group["filesize_maximum_images"], help="maximum filesize for images (default: %(default)s)")
runtime_opts.add_argument("--filesize_maximum_videos", type=int, default=config_group["filesize_maximum_videos"], help="maximum filesize for videos (default: %(default)s)")
@@ -283,18 +284,19 @@ async def director(args: Dict, links: List) -> None:
await sorter.sort()
log("")
- log("Checking for incomplete downloads")
- partial_downloads = any(f.is_file() for f in args['Files']['output_folder'].rglob("*.part"))
- temp_downloads = any(Path(f).is_file() for f in await SQL_Helper.get_temp_names())
-
- log('Purging empty directories')
- await purge_dir(args['Files']['output_folder'])
+ if args['Runtime']['check_for_partial_files_and_empty_dirs']:
+ log("Checking for incomplete downloads")
+ partial_downloads = any(f.is_file() for f in args['Files']['output_folder'].rglob("*.part"))
+ temp_downloads = any(Path(f).is_file() for f in await SQL_Helper.get_temp_names())
+
+ log('Purging empty directories')
+ await purge_dir(args['Files']['output_folder'])
+ if partial_downloads:
+ log('There are partial downloads in the downloads folder.', style="yellow")
+ if temp_downloads:
+ log('There are partial downloads from this run, please re-run the program.', style="yellow")
log('Finished downloading. Enjoy :)')
- if partial_downloads:
- log('There are partial downloads in the downloads folder.', style="yellow")
- if temp_downloads:
- log('There are partial downloads from this run, please re-run the program.', style="yellow")
log('')
log("If you enjoy using this program, please consider buying the developer a coffee :)\nhttps://www.buymeacoffee.com/juleswinnft", style="green")