From eac5ed5b617b34cef591838866789a936c66aa17 Mon Sep 17 00:00:00 2001 From: rlaphoenix Date: Thu, 15 Feb 2024 23:54:10 +0000 Subject: [PATCH] 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. --- devine/core/downloaders/aria2c.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/devine/core/downloaders/aria2c.py b/devine/core/downloaders/aria2c.py index be13061..bb79d75 100644 --- a/devine/core/downloaders/aria2c.py +++ b/devine/core/downloaders/aria2c.py @@ -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"]