aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-10-07 11:53:23 +0200
committerDanilo M. <danix@danix.xyz>2026-10-07 11:53:23 +0200
commit880d458e31baf1eceb3ae62bb69fdc56332d1558 (patch)
tree91b8b46e3b4e3e8160ebb599275419f136e466f2
parent1dfcbcd8305dc4711a67380f9b9edc13a829786d (diff)
downloadbunkr_dl-880d458e31baf1eceb3ae62bb69fdc56332d1558.tar.gz
bunkr_dl-880d458e31baf1eceb3ae62bb69fdc56332d1558.zip
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 <noreply@anthropic.com>
-rwxr-xr-xbunkr_dl17
1 files 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