Commit f5db4eb6 authored by rgaudin's avatar rgaudin
Browse files

Fixed #134: get metalink target even if no progress report

parent be0bc782
......@@ -182,6 +182,7 @@ def download_file(url, fpath, logger, checksum=None, debug=False):
except Exception:
downloaded_size, total_size = 1, -1
logger.ascii_progressbar(downloaded_size, total_size)
# parse filename from progress report
if (
metalink_target is None
and line.startswith("FILE:")
......@@ -191,6 +192,13 @@ def download_file(url, fpath, logger, checksum=None, debug=False):
output_dir, os.path.basename(line.split(":")[-1].strip())
)
# parse metalink filename from results summary (if not caught before)
if metalink_target is None and "|OK |" in line and "[MEMORY]" not in line:
metalink_target = os.path.join(
output_dir, os.path.basename(line.split("|", 4)[-1].strip())
)
if aria2c.poll() is None:
try:
aria2c.wait(timeout=2)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment