fix(downloader): correct progress bar tracking for segmented downloads

Use segmented=True when downloading multiple URLs to prevent inner downloads from overriding the total segment count, which caused the progress bar to always appear green (finished state).

This is still WIP so will continue to monitor.
This commit is contained in:
Andy
2026-01-31 20:00:30 -07:00
parent caf67a6998
commit ef338f0124

View File

@@ -122,7 +122,7 @@ def download(
last_speed_refresh = now
download_sizes.clear()
if content_length and written < content_length:
if not segmented and content_length and written < content_length:
raise IOError(f"Failed to read {content_length} bytes from the track URI.")
yield dict(file_downloaded=save_path, written=written)
@@ -264,7 +264,7 @@ def requests(
try:
with ThreadPoolExecutor(max_workers=max_workers) as pool:
for future in as_completed(pool.submit(download, session=session, segmented=False, **url) for url in urls):
for future in as_completed(pool.submit(download, session=session, segmented=True, **url) for url in urls):
try:
yield from future.result()
except KeyboardInterrupt: