forked from DRMTalks/devine
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:
parent
a8a89aab9c
commit
eac5ed5b61
|
@ -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"]
|
||||
|
|
Loading…
Reference in New Issue