Pretty up and improve readability of aria2c arguments

This commit is contained in:
rlaphoenix 2024-01-09 10:05:03 +00:00
parent 316f8f0530
commit dbfefc1d97
1 changed files with 22 additions and 16 deletions

View File

@ -60,26 +60,32 @@ async def aria2c(
async with start_pproxy(proxy) as pproxy_: async with start_pproxy(proxy) as pproxy_:
return await aria2c(uri, out, headers, cookies, pproxy_, silent, segmented, progress, *args) return await aria2c(uri, out, headers, cookies, pproxy_, silent, segmented, progress, *args)
file_allocation = config.aria2c.get("file_allocation", "prealloc")
if segmented:
file_allocation = "none"
arguments = [ arguments = [
"-c", # Continue downloading a partially downloaded file # [Basic Options]
"-x", "16", # The maximum number of connections to one server for each download "--input-file", "-",
"-j", "16", # The maximum number of parallel downloads for every static (HTTP/FTP) URL "--out", out.name,
"-s", ("1" if segmented else "16"), # Download a file using N connections
"--all-proxy", proxy or "", "--all-proxy", proxy or "",
"--continue=true",
# [Connection Options]
"--max-concurrent-downloads=16",
"--max-connection-per-server=16",
f"--split={1 if segmented else 16}", # each split uses their own connection
"--max-file-not-found=5", # counted towards --max-tries
"--max-tries=5",
"--retry-wait=2",
# [Advanced Options]
"--allow-overwrite=true", "--allow-overwrite=true",
"--auto-file-renaming=false", "--auto-file-renaming=false",
"--retry-wait", "2", # Set the seconds to wait between retries. "--console-log-level=warn",
"--max-tries", "5", f"--download-result={'default' if progress else 'hide'}",
"--max-file-not-found", "5", f"--file-allocation={file_allocation}",
"--summary-interval", "0", "--summary-interval=0",
"--file-allocation", [ # [Extra Options]
config.aria2c.get("file_allocation", "prealloc"), *args
"none"
][segmented],
"--console-log-level", "warn",
"--download-result", ["hide", "default"][bool(progress)],
*args,
"-i", "-"
] ]
if cookies: if cookies: