fix aria2c

This commit is contained in:
Concedo 2025-09-06 09:45:14 +08:00
parent f9ce2a00f0
commit 89feffc0e4

View file

@ -6507,9 +6507,12 @@ def downloader_internal(input_url, output_filename, capture_output, min_file_siz
basepath = os.path.abspath(os.path.dirname(__file__))
a2cexe = (os.path.join(basepath, "aria2c-win.exe"))
if os.path.exists(a2cexe): #on windows try using embedded a2cexe
out_dir = os.path.dirname(output_filename)
out_name = os.path.basename(output_filename)
rc = subprocess.run([
a2cexe, "-x", "16", "-s", "16", "--summary-interval=15", "--console-log-level=error", "--log-level=error",
"--download-result=default", "--continue=true", "--allow-overwrite=true", "--file-allocation=none", "--max-tries=3", "-o", output_filename, input_url
"--download-result=default", "--continue=true", "--allow-overwrite=true", "--file-allocation=none", "--max-tries=3",
"-d", out_dir, "-o", out_name, input_url
], capture_output=capture_output, text=True, check=True, encoding='utf-8')
dl_success = (rc.returncode == 0 and os.path.exists(output_filename) and os.path.getsize(output_filename) > min_file_size)
except subprocess.CalledProcessError as e:
@ -6517,9 +6520,12 @@ def downloader_internal(input_url, output_filename, capture_output, min_file_siz
try:
if not dl_success and shutil.which("aria2c") is not None:
out_dir = os.path.dirname(output_filename)
out_name = os.path.basename(output_filename)
rc = subprocess.run([
"aria2c", "-x", "16", "-s", "16", "--summary-interval=15", "--console-log-level=error", "--log-level=error",
"--download-result=default", "--allow-overwrite=true", "--file-allocation=none", "--max-tries=3", "-o", output_filename, input_url
"--download-result=default", "--allow-overwrite=true", "--file-allocation=none", "--max-tries=3",
"-d", out_dir, "-o", out_name, input_url
], capture_output=capture_output, text=True, check=True, encoding='utf-8')
dl_success = (rc.returncode == 0 and os.path.exists(output_filename) and os.path.getsize(output_filename) > min_file_size)
except subprocess.CalledProcessError as e: