Merge pull request #47 from BLucky-gh/master
Fix magnet regex and misleading error msg after success in automated downloader cell
This commit is contained in:
commit
648ba335b2
|
@ -1429,14 +1429,13 @@
|
|||
" print(str)\n",
|
||||
" raise\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_dl_file = None\n",
|
||||
"gdrive_file_id = None\n",
|
||||
"\n",
|
||||
"if magnet_match:\n",
|
||||
" !apt update\n",
|
||||
" !apt install -y aria2\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",
|
||||
" %cd \"{model_storage_dir}\"\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",
|
||||
|
@ -1467,8 +1466,8 @@
|
|||
"elif gdrive_file_id is not None:\n",
|
||||
" %cd \"{model_storage_dir}\"\n",
|
||||
" gdown.download(f\"https://drive.google.com/uc?id={gdrive_file_id}&confirm=t\")\n",
|
||||
"else:\n",
|
||||
" print('Could not parse your URI.')"
|
||||
"elif magnet_match: pass\n",
|
||||
"else: print('Could not parse your URI.')"
|
||||
]
|
||||
}
|
||||
],
|
||||
|
|
Loading…
Reference in New Issue