Aria2c: Fix completed progress information

For some reason aria2c has like 700 internal "download" structs per actual URL it was downloading, probably something to do with multiple connections/split, don't know don't care, as this way works just fine.
This commit is contained in:
rlaphoenix 2024-02-15 23:54:10 +00:00
parent a8a89aab9c
commit eac5ed5b61
1 changed files with 3 additions and 3 deletions

View File

@ -202,8 +202,10 @@ def download(
secret=rpc_secret,
method="aria2.getGlobalStat"
)
number_stopped = int(global_stats["numStoppedTotal"])
if global_stats:
yield dict(
completed=number_stopped,
downloaded=f"{filesize.decimal(int(global_stats['downloadSpeed']))}/s"
)
@ -214,9 +216,7 @@ def download(
params=[0, 999999]
) or []
for dl in stopped_downloads:
if dl["status"] == "complete":
yield dict(advance=1)
elif dl["status"] == "error":
if dl["status"] == "error":
used_uri = next(
uri["uri"]
for file in dl["files"]