From 880d458e31baf1eceb3ae62bb69fdc56332d1558 Mon Sep 17 00:00:00 2001 From: "Danilo M." Date: Wed, 7 Oct 2026 11:53:23 +0200 Subject: Reuse existing album folder so reruns resume A rerun used to create "Title - 2" and start every file from scratch, so the Range resume and 416 skip in download_file never applied. Download into the plain album folder instead and drop the now unused ensure_unique_folder helper. Co-Authored-By: Claude Opus 5.5 --- bunkr_dl | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/bunkr_dl b/bunkr_dl index 9ea1184..3614745 100755 --- a/bunkr_dl +++ b/bunkr_dl @@ -177,19 +177,6 @@ def download_file(file_url, file_name, save_dir, retries=5): print(f"Failed to download {file_url} after {retries} attempts.") return None -def ensure_unique_folder(base_folder, folder_name): - """Ensure the folder name is unique by adding suffixes like ' - 2', ' - 3' if necessary""" - folder_path = os.path.join(base_folder, folder_name) - if not os.path.exists(folder_path): - return folder_path - - # If folder exists, add a numerical suffix - suffix = 2 - while os.path.exists(f"{folder_path} - {suffix}"): - suffix += 1 - - return f"{folder_path} - {suffix}" - def process_album(album_url, base_save_directory): """Process a single album to download all media""" soup = get_soup(album_url) @@ -197,8 +184,8 @@ def process_album(album_url, base_save_directory): return album_title = extract_album_title(soup) - # Create a unique subfolder for the album title inside the base directory - album_save_directory = ensure_unique_folder(base_save_directory, album_title) + # Reuse an existing album folder so a rerun resumes instead of starting over + album_save_directory = os.path.join(base_save_directory, album_title) os.makedirs(album_save_directory, exist_ok=True) # Step 1: Get all media links (images/videos) from the album page -- cgit v1.2.3