fix: count only absolute path lines in _count_downloaded_files

This commit is contained in:
2026-03-18 23:39:45 -04:00
parent 080a1254c7
commit 48d10ec21e
+5 -9
View File
@@ -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,