diff --git a/backend/app/services/gallery_dl.py b/backend/app/services/gallery_dl.py index ef5e328..b0d38c9 100644 --- a/backend/app/services/gallery_dl.py +++ b/backend/app/services/gallery_dl.py @@ -542,19 +542,15 @@ class GalleryDLService: def _count_downloaded_files(self, stdout: str) -> int: """Count the number of files downloaded from stdout. - Gallery-dl outputs one line per downloaded file. - Lines starting with '#' or containing 'skip' are not downloads. + Gallery-dl writes each downloaded file path to stdout as an absolute path + (starting with '/'). Log lines contain '[' prefixes; verbose HTTP lines + go to stderr. Counting only lines starting with '/' avoids over-counting + log and progress output. """ if not stdout: return 0 - count = 0 - for line in stdout.strip().split("\n"): - line = line.strip() - if line and not line.startswith("#") and "skip" not in line.lower(): - count += 1 - - return count + return sum(1 for line in stdout.splitlines() if line.strip().startswith("/")) async def download( self,