Skip to content

Commit

Permalink
update notebook download cell
Browse files Browse the repository at this point in the history
  • Loading branch information
Yoinky3000 committed Jun 22, 2024
1 parent 1199afb commit f241051
Showing 1 changed file with 15 additions and 12 deletions.
27 changes: 15 additions & 12 deletions workspace/SD Next.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -55,17 +55,23 @@
"%cd /workspace\n",
"\n",
"import os\n",
"from urllib.parse import urlsplit\n",
"import requests\n",
"\n",
"for dl in DOWNLOAD_LIST:\n",
" link = dl[0]\n",
" if len(dl) == 2:\n",
" dest = dl[1]\n",
" os.makedirs(dest, exist_ok=True)\n",
" !cd \"$dest\" && curl --create-dirs -J -L -O \"$link\"\n",
" else:\n",
" !cd /workspace && curl -L -O \"$link\"\n",
"\n",
"print(\"Download finished\")"
" baseLink = dl[0]\n",
" filename = os.path.basename(urlsplit(baseLink).path)\n",
" \n",
" finalLink = requests.head(baseLink, allow_redirects=True).url\n",
" filename = filename if \".\" in filename else os.path.basename(urlsplit(finalLink).path)\n",
" \n",
" dest = f'\"{dl[1] if len(dl) == 2 else \"./\"}{filename}\"'\n",
" baseLink = f'\"{baseLink}\"'\n",
"\n",
" print(f'\\n\\nDownloading {filename} to {dest}...')\n",
" !curl --create-dirs -L $baseLink -o $dest\n",
"\n",
"print(\"\\n\\nDownload finished\")"
]
},
{
Expand All @@ -84,9 +90,6 @@
"\n",
"# ========================================================================\n",
"\n",
"\n",
"# DON'T CHANGE ANYTHING BELOW\n",
"\n",
"!/sdnext-git.sh"
]
}
Expand Down

0 comments on commit f241051

Please sign in to comment.