Fix magnet regex and misleading error msg after success
This commit is contained in:
parent
dd7103722a
commit
45601b6809
|
@ -1429,12 +1429,11 @@
|
||||||
" print(str)\n",
|
" print(str)\n",
|
||||||
" raise\n",
|
" raise\n",
|
||||||
"\n",
|
"\n",
|
||||||
"magnet_match = re.search(r'magnet:\\?xt=urn:btih:[A-Za-z0-9&=%.]*', model_uri)\n",
|
"magnet_match = re.search(r'magnet:\\?xt=urn:btih:[\\-_A-Za-z0-9&=%.]*', model_uri)\n",
|
||||||
"web_match = re.search(r'(https?:\\/\\/(?:www\\.|(?!www))[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9]\\.[^\\s]{2,}|www\\.[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9]\\.[^\\s]{2,}|https?:\\/\\/(?:www\\.|(?!www))[a-zA-Z0-9]+\\.[^\\s]{2,}|www\\.[a-zA-Z0-9]+\\.[^\\s]{2,})', model_uri)\n",
|
"web_match = re.search(r'(https?:\\/\\/(?:www\\.|(?!www))[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9]\\.[^\\s]{2,}|www\\.[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9]\\.[^\\s]{2,}|https?:\\/\\/(?:www\\.|(?!www))[a-zA-Z0-9]+\\.[^\\s]{2,}|www\\.[a-zA-Z0-9]+\\.[^\\s]{2,})', model_uri)\n",
|
||||||
"web_dl_file = None\n",
|
"web_dl_file = None\n",
|
||||||
"if magnet_match:\n",
|
"if magnet_match:\n",
|
||||||
" !apt update\n",
|
" !if [ $(dpkg-query -W -f='${Status}' aria2 2>/dev/null | grep -c \"ok installed\") = 0 ]; then sudo apt update && sudo apt install -y aria2; fi\n",
|
||||||
" !apt install -y aria2\n",
|
|
||||||
" %cd \"{model_storage_dir}\"\n",
|
" %cd \"{model_storage_dir}\"\n",
|
||||||
" bash_var = magnet_match[0]\n",
|
" bash_var = magnet_match[0]\n",
|
||||||
" !aria2c --seed-time=0 --max-overall-upload-limit=1K --bt-max-peers=120 --summary-interval=0 --file-allocation=none \"{bash_var}\"\n",
|
" !aria2c --seed-time=0 --max-overall-upload-limit=1K --bt-max-peers=120 --summary-interval=0 --file-allocation=none \"{bash_var}\"\n",
|
||||||
|
@ -1465,8 +1464,8 @@
|
||||||
"elif gdrive_file_id is not None:\n",
|
"elif gdrive_file_id is not None:\n",
|
||||||
" %cd \"{model_storage_dir}\"\n",
|
" %cd \"{model_storage_dir}\"\n",
|
||||||
" gdown.download(f\"https://drive.google.com/uc?id={gdrive_file_id}&confirm=t\")\n",
|
" gdown.download(f\"https://drive.google.com/uc?id={gdrive_file_id}&confirm=t\")\n",
|
||||||
"else:\n",
|
"elif magnet_match: pass\n",
|
||||||
" print('Could not parse your URI.')"
|
"else: print('Could not parse your URI.')"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|
Loading…
Reference in New Issue