mirror of
https://github.com/unshackle-dl/unshackle.git
synced 2026-03-10 00:19:01 +00:00
Merge pull request #88 from CodeName393/fix-aria2c-progress-bar
fix(aria2c): Correct progress bar tracking for HLS downloads
This commit is contained in:
@@ -431,14 +431,24 @@ def download(
|
|||||||
raise ValueError(error)
|
raise ValueError(error)
|
||||||
|
|
||||||
# Yield aggregate progress for this call's downloads
|
# Yield aggregate progress for this call's downloads
|
||||||
if total_size > 0:
|
progress_data = {"advance": 0}
|
||||||
# Yield both advance (bytes downloaded this iteration) and total for rich progress
|
|
||||||
if dl_speed != -1:
|
if len(gids) > 1:
|
||||||
yield dict(downloaded=f"{filesize.decimal(dl_speed)}/s", advance=0, completed=total_completed, total=total_size)
|
# Multi-file mode (e.g., HLS): Return the count of completed segments
|
||||||
|
progress_data["completed"] = len(completed)
|
||||||
|
progress_data["total"] = len(gids)
|
||||||
|
else:
|
||||||
|
# Single-file mode: Return the total bytes downloaded
|
||||||
|
progress_data["completed"] = total_completed
|
||||||
|
if total_size > 0:
|
||||||
|
progress_data["total"] = total_size
|
||||||
else:
|
else:
|
||||||
yield dict(advance=0, completed=total_completed, total=total_size)
|
progress_data["total"] = None
|
||||||
elif dl_speed != -1:
|
|
||||||
yield dict(downloaded=f"{filesize.decimal(dl_speed)}/s")
|
if dl_speed != -1:
|
||||||
|
progress_data["downloaded"] = f"{filesize.decimal(dl_speed)}/s"
|
||||||
|
|
||||||
|
yield progress_data
|
||||||
|
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
|
|||||||
Reference in New Issue
Block a user