mirror of
https://github.com/LostRuins/koboldcpp.git
synced 2025-09-10 17:14:36 +00:00
allowing resuming incomplete aria2 downloads
This commit is contained in:
parent
8faf01016d
commit
6f4f1b7389
1 changed files with 3 additions and 2 deletions
|
@ -6219,7 +6219,8 @@ def downloader_internal(input_url, output_filename, capture_output, min_file_siz
|
||||||
input_url = input_url.replace("/blob/main/", "/resolve/main/")
|
input_url = input_url.replace("/blob/main/", "/resolve/main/")
|
||||||
if output_filename == "auto":
|
if output_filename == "auto":
|
||||||
output_filename = os.path.basename(input_url).split('?')[0].split('#')[0]
|
output_filename = os.path.basename(input_url).split('?')[0].split('#')[0]
|
||||||
if os.path.exists(output_filename) and os.path.getsize(output_filename) > min_file_size:
|
incomplete_dl_exist = (os.path.exists(output_filename+".aria2") and os.path.getsize(output_filename+".aria2") > 16)
|
||||||
|
if os.path.exists(output_filename) and os.path.getsize(output_filename) > min_file_size and not incomplete_dl_exist:
|
||||||
print(f"{output_filename} already exists, using existing file.")
|
print(f"{output_filename} already exists, using existing file.")
|
||||||
return output_filename
|
return output_filename
|
||||||
print(f"Downloading {input_url}", flush=True)
|
print(f"Downloading {input_url}", flush=True)
|
||||||
|
@ -6232,7 +6233,7 @@ def downloader_internal(input_url, output_filename, capture_output, min_file_siz
|
||||||
if os.path.exists(a2cexe): #on windows try using embedded a2cexe
|
if os.path.exists(a2cexe): #on windows try using embedded a2cexe
|
||||||
rc = subprocess.run([
|
rc = subprocess.run([
|
||||||
a2cexe, "-x", "16", "-s", "16", "--summary-interval=15", "--console-log-level=error", "--log-level=error",
|
a2cexe, "-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", "--continue=true", "--allow-overwrite=true", "--file-allocation=none", "--max-tries=3", "-o", output_filename, input_url
|
||||||
], capture_output=capture_output, text=True, check=True, encoding='utf-8')
|
], 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)
|
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:
|
except subprocess.CalledProcessError as e:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue