Commit ab907553 authored by rgaudin's avatar rgaudin
Browse files

Merge branch 'aria2-logs' into 'master'

Use aria2 summary to retrieve metalink info

See merge request !58
parents cf691ecc 4fdf5dc8
......@@ -182,22 +182,13 @@ 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:")
and "[MEMORY]" not in line
metalink_target = os.path.join(
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())
logger.std(".. found metalink_target: {mt}".format(mt=metalink_target))
if aria2c.poll() is None:
......@@ -216,9 +207,15 @@ def download_file(url, fpath, logger, checksum=None, debug=False):
if metalink_target is not None and metalink_target != fpath:
logger.std("mv {src} {dst}".format(src=metalink_target, dst=fpath))
logger.std(".. mv {src} {dst}".format(src=metalink_target, dst=fpath))
os.replace(metalink_target, fpath)
".. not moving metalink_target: {mt} into {fp}".format(
mt=metalink_target, fp=fpath
return RequestedFile.from_download(url, fpath, os.path.getsize(fpath))
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