Skip to content

Bulk asynchronous downloader for multiple file hosts

Limit coomer/kemono downloads to 8 simultaneous. We also attempt to fix album name collisions in the same way we do with domains.

Jules-WinnfieldX8c14c29f0fff
diff --git a/cyberdrop_dl/__init__.py b/cyberdrop_dl/__init__.py
index cea72b28c..b6bcbb03b 100644
--- a/cyberdrop_dl/__init__.py
+++ b/cyberdrop_dl/__init__.py
@@ -1 +1 @@
-__version__ = "4.2.72"
+__version__ = "4.2.73"
diff --git a/cyberdrop_dl/downloader/downloader_utils.py b/cyberdrop_dl/downloader/downloader_utils.py
index 676a09ddb..a044f171a 100644
--- a/cyberdrop_dl/downloader/downloader_utils.py
+++ b/cyberdrop_dl/downloader/downloader_utils.py
@@ -53,6 +53,8 @@ def get_threads_number(args: Dict, domain: str) -> int:
threads = args["Runtime"]["max_concurrent_downloads_per_domain"] or multiprocessing.cpu_count()
if any(s in domain for s in ('anonfiles', 'bunkr', 'pixeldrain', 'cyberfile')):
return min(threads, 2)
+ if any(s in domain for s in ('coomer', 'kemono')):
+ return min(threads, 8)
return threads
diff --git a/cyberdrop_dl/downloader/downloaders.py b/cyberdrop_dl/downloader/downloaders.py
index b6bede687..f2e13a54e 100644
--- a/cyberdrop_dl/downloader/downloaders.py
+++ b/cyberdrop_dl/downloader/downloaders.py
@@ -415,7 +415,7 @@ class DownloadDirector:
download_tasks.append(self.start_file(downloader, album_task, domain, album, media))
await asyncio.gather(*download_tasks)
await self.Progress_Master.DomainProgress.advance_domain(domain_task)
- await self.Progress_Master.AlbumProgress.mark_album_completed(album_task)
+ await self.Progress_Master.AlbumProgress.mark_album_completed(album, album_task)
async def start_file(self, downloader: Downloader, album_task: TaskID, domain: str, album: str,
media: MediaItem) -> None:
diff --git a/cyberdrop_dl/downloader/progress_definitions.py b/cyberdrop_dl/downloader/progress_definitions.py
index 26d1d15fc..8b9ba77b0 100644
--- a/cyberdrop_dl/downloader/progress_definitions.py
+++ b/cyberdrop_dl/downloader/progress_definitions.py
@@ -279,21 +279,38 @@ class AlbumProgress:
self.type_str = "Albums"
self.progress = _Progress(self.album_progress, progressions.album_progress_overflow, self.color, "Albums", visible_tasks_limit)
+ self.albums: Dict[str, TaskID] = {}
+ self.albums_totals: Dict[str, int] = {}
+
async def add_album(self, album: str, total_files: int) -> TaskID:
task_description = album.split('/')[-1]
task_description = task_description.encode("ascii", "ignore").decode().strip()
- task_description = adjust_title(task_description)
+ task_description = adjust_title(task_description).upper()
+
+ if task_description in self.albums:
+ self.albums_totals[task_description] += total_files
+ await self.progress.update_total(self.albums[task_description], self.albums_totals[task_description])
+ else:
+ self.albums[task_description] = await self.progress.add_task(task_description, total_files)
+ self.albums_totals[task_description] = total_files
- task_id = await self.progress.add_task(task_description.upper(), total_files)
await self.progress.redraw()
- return task_id
+ return self.albums[task_description]
async def advance_album(self, task_id: TaskID) -> None:
await self.progress.advance_task(task_id, 1)
- async def mark_album_completed(self, task_id: TaskID) -> None:
- await self.progress.mark_task_completed(task_id)
- await self.progress.redraw()
+ async def mark_album_completed(self, album: str, task_id: TaskID) -> None:
+ task_description = album.split('/')[-1]
+ task_description = task_description.encode("ascii", "ignore").decode().strip()
+ task_description = adjust_title(task_description).upper()
+
+ task = [x for x in self.album_progress.tasks if x.id == task_id][0]
+ if task.finished:
+ with contextlib.suppress(KeyError):
+ self.albums.pop(task_description)
+ self.albums_totals.pop(task_description)
+ await self.progress.mark_task_completed(task_id)
class FileProgress: