mirror of https://github.com/devine-dl/devine.git
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,
|
secret=rpc_secret,
|
||||||
method="aria2.getGlobalStat"
|
method="aria2.getGlobalStat"
|
||||||
)
|
)
|
||||||
|
number_stopped = int(global_stats["numStoppedTotal"])
|
||||||
if global_stats:
|
if global_stats:
|
||||||
yield dict(
|
yield dict(
|
||||||
|
completed=number_stopped,
|
||||||
downloaded=f"{filesize.decimal(int(global_stats['downloadSpeed']))}/s"
|
downloaded=f"{filesize.decimal(int(global_stats['downloadSpeed']))}/s"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -214,9 +216,7 @@ def download(
|
||||||
params=[0, 999999]
|
params=[0, 999999]
|
||||||
) or []
|
) or []
|
||||||
for dl in stopped_downloads:
|
for dl in stopped_downloads:
|
||||||
if dl["status"] == "complete":
|
if dl["status"] == "error":
|
||||||
yield dict(advance=1)
|
|
||||||
elif dl["status"] == "error":
|
|
||||||
used_uri = next(
|
used_uri = next(
|
||||||
uri["uri"]
|
uri["uri"]
|
||||||
for file in dl["files"]
|
for file in dl["files"]
|
||||||
|
|
Loading…
Reference in New Issue