diff --git a/Jac12/extensions/batchlinks-webui-main/.github/CODEOWNERS b/Jac12/extensions/batchlinks-webui-main/.github/CODEOWNERS
new file mode 100644
index 0000000000000000000000000000000000000000..ea30e3119f3bb1dbefb1ecddcf5e2c2af997a482
--- /dev/null
+++ b/Jac12/extensions/batchlinks-webui-main/.github/CODEOWNERS
@@ -0,0 +1,2 @@
+# Global rule:
+* @etherealxx
diff --git a/Jac12/extensions/batchlinks-webui-main/.gitignore b/Jac12/extensions/batchlinks-webui-main/.gitignore
new file mode 100644
index 0000000000000000000000000000000000000000..ef06d19b1f72bc93f56af94b78a7d52724a9daf3
--- /dev/null
+++ b/Jac12/extensions/batchlinks-webui-main/.gitignore
@@ -0,0 +1,168 @@
+*.bak
+*.backup
+imageratio.*
+*.lnk
+tempCodeRunnerFile.python
+.DS_Store
+gradiovenv/
+
+# Byte-compiled / optimized / DLL files
+__pycache__/
+*.py[cod]
+*$py.class
+
+# C extensions
+*.so
+
+# Distribution / packaging
+.Python
+build/
+develop-eggs/
+dist/
+downloads/
+eggs/
+.eggs/
+lib/
+lib64/
+parts/
+sdist/
+var/
+wheels/
+share/python-wheels/
+*.egg-info/
+.installed.cfg
+*.egg
+MANIFEST
+
+# PyInstaller
+# Usually these files are written by a python script from a template
+# before PyInstaller builds the exe, so as to inject date/other infos into it.
+*.manifest
+*.spec
+
+# Installer logs
+pip-log.txt
+pip-delete-this-directory.txt
+
+# Unit test / coverage reports
+htmlcov/
+.tox/
+.nox/
+.coverage
+.coverage.*
+.cache
+nosetests.xml
+coverage.xml
+*.cover
+*.py,cover
+.hypothesis/
+.pytest_cache/
+cover/
+
+# Translations
+*.mo
+*.pot
+
+# Django stuff:
+*.log
+local_settings.py
+db.sqlite3
+db.sqlite3-journal
+
+# Flask stuff:
+instance/
+.webassets-cache
+
+# Scrapy stuff:
+.scrapy
+
+# Sphinx documentation
+docs/_build/
+
+# PyBuilder
+.pybuilder/
+target/
+
+# Jupyter Notebook
+.ipynb_checkpoints
+
+# IPython
+profile_default/
+ipython_config.py
+
+# pyenv
+# For a library or package, you might want to ignore these files since the code is
+# intended to run in multiple environments; otherwise, check them in:
+# .python-version
+
+# pipenv
+# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
+# However, in case of collaboration, if having platform-specific dependencies or dependencies
+# having no cross-platform support, pipenv may install dependencies that don't work, or not
+# install all needed dependencies.
+#Pipfile.lock
+
+# poetry
+# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
+# This is especially recommended for binary packages to ensure reproducibility, and is more
+# commonly ignored for libraries.
+# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
+#poetry.lock
+
+# pdm
+# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
+#pdm.lock
+# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
+# in version control.
+# https://pdm.fming.dev/#use-with-ide
+.pdm.toml
+
+# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
+__pypackages__/
+
+# Celery stuff
+celerybeat-schedule
+celerybeat.pid
+
+# SageMath parsed files
+*.sage.py
+
+# Environments
+.env
+.venv
+env/
+venv/
+ENV/
+env.bak/
+venv.bak/
+
+# Spyder project settings
+.spyderproject
+.spyproject
+
+# Rope project settings
+.ropeproject
+
+# mkdocs documentation
+/site
+
+# mypy
+.mypy_cache/
+.dmypy.json
+dmypy.json
+
+# Pyre type checker
+.pyre/
+
+# pytype static type analyzer
+.pytype/
+
+# Cython debug symbols
+cython_debug/
+
+# PyCharm
+# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
+# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
+# and can be added to the global gitignore or merged into this file. For a more nuclear
+# option (not recommended) you can uncomment the following to ignore the entire idea folder.
+#.idea/
diff --git a/Jac12/extensions/batchlinks-webui-main/LICENSE b/Jac12/extensions/batchlinks-webui-main/LICENSE
new file mode 100644
index 0000000000000000000000000000000000000000..dfd7367e611d85047cdf8e09109a9b77f08eb861
--- /dev/null
+++ b/Jac12/extensions/batchlinks-webui-main/LICENSE
@@ -0,0 +1,21 @@
+MIT License
+
+Copyright (c) 2023 Etherealxx
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/Jac12/extensions/batchlinks-webui-main/README.md b/Jac12/extensions/batchlinks-webui-main/README.md
new file mode 100644
index 0000000000000000000000000000000000000000..8538b40fdd03f1dc08e19ced931461f592aee879
--- /dev/null
+++ b/Jac12/extensions/batchlinks-webui-main/README.md
@@ -0,0 +1,491 @@
+
+
+
+
+
+
+
+
BatchLinks Downloader
+
+
+ Batch-downloading models and stuff in stable-diffusion-webui colab made simple and fast.
+
+
+
+ Report Bug
+ ·
+ Request Feature
+
+
+
+
+
+
+
+
+
+ Table of Contents
+
+ - Installation
+ - About
+ - Example
+ - Syntax
+
+
+
+
+
+
+
+ - Additional Syntax
+
+
+
+
+
+ - Gradio Queue
+
+
+
+
+ - Other Features
+
+
+
+
+
+ - Release Notes
+ - Roadmap
+ - Known Bugs
+
+ - Contributing
+ - Contact
+ - Acknowledgments
+
+
+
+
+[does this repo still maintained?](https://github.com/etherealxx/batchlinks-webui/blob/main/regardingthisrepo.md)
+
+## Installation
+
+Copy this line into your colab installation cell. Or into a new cell if you already launched the webui.
+
+```
+!git clone https://github.com/etherealxx/batchlinks-webui /content/stable-diffusion-webui/extensions/batchlinks-webui
+```
+
+or, you can copy the url of this repo and install it via webui and restart the UI.
+
+(If `gradio no interface is running` or `bad gateway` shows up when restarting the UI, that means you need to restart the cell anyway 😅)
+
+
+
+Using `--gradio-queue` on the launch.py argument is highly recommended, as it enables this extension to show download progress bar on the UI and a cancel button. The option itself has no negative effect on the webui. [Read more here.](https://github.com/etherealxx/batchlinks-webui#gradio-queue)
+
+
+You can also run this extension in [SDless mode](https://github.com/etherealxx/batchlinks-webui#sdless-mode) btw.
+
+While it's not recommended to use this extension on your local installation, you can use this extension on Windows. [More here.](https://github.com/etherealxx/batchlinks-webui#local-installation-support)
+
+## About
+
+This extension will streamline your downloads on your [stable-diffusion-webui](https://github.com/AUTOMATIC1111/stable-diffusion-webui) colab session. Paste the links you need to download (or you can upload a txt file containing the links), use the hashstag syntax to choose the download location (see below), and hit the `Download All` button to download them!
+
+## Example
+
+Look at this example
+
+
+```
+#model
+https://huggingface.co/WarriorMama777/OrangeMixs/resolve/main/Models/AbyssOrangeMix3/AOM3_orangemixs.safetensors
+#vae
+https://huggingface.co/hakurei/waifu-diffusion-v1-4/resolve/main/vae/kl-f8-anime2.ckpt
+#embed
+https://huggingface.co/datasets/Nerfgun3/bad_prompt/resolve/main/bad_prompt_version2.pt
+https://huggingface.co/etherealxx/whoseisthis/resolve/main/bad_artist.pt
+#lora
+https://civitai.com/api/download/models/8840 ##1-mb-lora-trained-in-5-mins-that-does-the-same-thing-as-25-gb-model-but-better
+https://civitai.com/api/download/models/6891 ##sans undertale
+https://mega.nz/file/gAxTWBAI#uL7EZay-OND5G6ELJlGfUNG0s7Q4TynZKqFdvs0v0tc ##agent8-finetune
+https://mega.nz/file/oU43FSTY#vwAfsAb7RKJ4xtsSP7uzrKpWhh1y8BdpIBFurwsVP2o ##agent8-dreambooth
+#hypernet
+https://cdn.discordapp.com/attachments/1070489470127841381/1070489471964954684/MomopocoV3.pt
+```
+
+This piece of lines will be read from top to bottom. Every hashtag, it will change the current output directory to said directory (see below). So what this example do is it will download `AOM3` model to the model folder, then it will download the vae and put it to the Vae folder. Next it will download two embed, `bad prompt` and `bad artist`. Next it will download several LoRAs from CivitAI and MEGA, and put it to the Lora folder. Lastly, it changes the directory to hypernet directory, then
+
+You can also copy that example and paste it to a `.txt` file to use later. You can load a `.txt` file containing that piece of lines directly from the UI.
+
+When the items is downloading, you can inspect the running code on the colab cell, or just take a coffee and chill☕. If you activate logging, you can inspect the download progress from the UI, more [here](https://github.com/etherealxx/batchlinks-webui#logging)
+
+When the download is complete, the downloaded file will be listed
+
+
+## Syntax
+
+#### Hashtag
+- Hashtag means change current output directory to this directory. `#model` means every links below this hashtag, will be downloaded to _/content/stable-diffusion-webui/models/Stable-diffusion_, until it hits another hashtag, which will change the output directory again. See [below](https://github.com/etherealxx/batchlinks-webui#valid-hashtags) for valid hashtags.
+
+ Note: If you use some colab that purposefully uses `sd-webui-additional-networks` extension to load Lora, use `#addnetlora` instead of `#lora`. It will download the lora to where it supposed to be.
+
+#### Links
+- Links are the main things you wants to be downloaded. Current supported links are from:
+ - Huggingface (https://huggingface.co/)
+ - MEGA (https://mega.nz/) {using `mega-cmd`}
+ - CivitAI (https://civitai.com/)
+ - Discord attachments (https://cdn.discordapp.com/attachments/)
+ - catbox (https://files.catbox.moe)
+ - Github (https://github.com or https://raw.githubusercontent.com)
+ - Google Drive (https://drive.google.com) {using `gdown`}
+ - Pixeldrain (https://pixeldrain.com/u/)
+ - Mediafire (https://www.mediafire.com/file) {using `mediafire-dl`}
+ - anonfiles (https://anonfiles.com)
+
+ Every links other than that will be ignored. Keep in mind the only supported links are direct download links (see [here](https://github.com/etherealxx/batchlinks-downloader/blob/main/howtogetthedirectlinks.md)). For Huggingface, Civitai (model page link method), Discord attachments, catbox, pixeldrain, and anonfiles, there will be four different method of downloading offered (see [below](https://github.com/etherealxx/batchlinks-webui#huggingfaces-download-method)). For MEGA, it will use `mega-cmd` to download. For Github, if, the link is a raw file, it will download the file. Else, it will use `git clone`, useful to clone extension repo into the webui extension folder.
+
+ More about CivitAI download method [here](https://github.com/etherealxx/batchlinks-webui#civitais-download-method).
+
+#### Double Hashtag
+- Double hashtag means comment. You can put double hashtag in the same line of the link and it will be ignored (keep in mind to put the link first then the double hashtag)
+
+#### Others
+- Other texts will be ignored.
+
+### Valid Hashtags
+
+`#model`, `#models`, `#checkpoint`, or `#checkpoints` will put the downloaded file to _/content/stable-diffusion-webui/models/Stable-diffusion_
+
+`#embedding`, `#embeddings`, `#embed`, `#embeds`, `#textualinversion`, or `#ti` will put the downloaded file to _/content/stable-diffusion-webui/embeddings_
+
+`#vae` or `#vaes` will put the downloaded file to _/content/stable-diffusion-webui/models/VAE_
+
+`#hypernetwork`, `#hypernetworks`, `#hypernet`, `#hypernets`, `#hynet`, or `#hynets` will put the downloaded file to _/content/stable-diffusion-webui/models/hypernetworks_
+
+`#lora` or `#loras` will put the downloaded file to _/content/stable-diffusion-webui/models/Lora_
+
+`#addnetlora`, `#loraaddnet`, `#additionalnetworks`, or `#addnet` will put the downloaded file to _/content/stable-diffusion-webui/extensions/sd-webui-additional-networks/models/lora_
+
+`#aestheticembedding` or `#aestheticembed` will put the downloaded file to _content/stable-diffusion-webui/extensions/stable-diffusion-webui-aesthetic-gradients/aesthetic_embeddings_
+
+`#controlnet` or `#cnet` will put the downloaded file to _/content/stable-diffusion-webui/extensions/sd-webui-controlnet/models_
+
+`#upscale` or `#upscaler` will put the downloaded file to _/content/stable-diffusion-webui/models/ESRGAN_
+
+`#lycoris`, `#locon`, or `#loha` will put the downloaded file to _/content/stable-diffusion-webui/extensions/sd-webui-additional-networks/models/lora/lycoris_
+
+`#altmodel` or `#altmodels` will put the downloaded file to the path you choose when using `--ckptdir` argument on `launch.py` line. If you didn't use that argument, this hashtag will points to the same directory as `#model`
+
+_Lycoris/Locon/Loha_ will works just fine if you use `#addnetlora` instead, as long as you have both [addnet extension](https://github.com/kohya-ss/sd-webui-additional-networks) and [locon extension](https://github.com/KohakuBlueleaf/a1111-sd-webui-locon) installed. It's unclear if it's can be loaded by native auto1111 lora. (Tell me if you know more about this.)
+
+Github links (if it does not contain `/raw/` or `/release/download/` in it) doesn't need hashtag. It will always considered as webui extension, and the repository will be cloned to _/content/stable-diffusion-webui/extensions/(reponame)_
+
+### How to get the direct links (Important!)
+
+See [here](https://github.com/etherealxx/batchlinks-downloader/blob/main/howtogetthedirectlinks.md)
+
+### Huggingface's download method
+
+So there's four supported method: `gdown`, `wget`, `curl` and `aria2`. Use whatever, really. The difference between them are actually little. Myself love using `gdown` since the output is cleaner than the others. `aria2` has the fastest download speed though.
+
+
+
+## Additional Syntax
+### Rename Downloaded Files
+Using `>` symbol, you can rename files. Take this for example
+
+Mostly catbox file has random name, by using `>` symbol after the link, you can type the desired name on the right. (Don't forget the extension)
+
+### Running Shell Commands
+You can run shell commands by using `!` in front of the command you want, just like in google colab cells. Then press the `Download All!` button. (Sure, it doesn't download anything, but, well😅)
+
+
+You can run many lines at once too!
+
+### Extract Everyting (`@extract`)
+You can use `@extract` to extract every `*.7z`, `*.rar`, and `*.zip` on current directory).
+```
+#lora
+
+@extract
+#embed
+```
+This will extract everything on Lora folder, since the code runs from top to bottom, and when the `@extract` executes, the current directory is still on Lora folder.
+
+### Custom Hashtag Path (`@new`)
+You can use `@new ` to make a new usable hashtag and assign a directory path to it.
For example, you type this and press the `Download All!` button:
+```
+@new #private /content/stable-diffusion-webui/outputs
+#private
+
+```
+This will make a new hashtag `#private`, make it points to _/content/stable-diffusion-webui/outputs_, set `#private` as current directory, then download whatever into it. You can check if the new hashtag is assigned successfully by looking at the hashtag table on the right/bottom of the screen.
+
+### Custom Direct Link Download with `aria2` (`@aria2`)
+If there are other direct links that isn't supported by Batchlinks, you can use `@aria` or `@aria2` custom command to download it. The main syntax is:
+```
+@aria2 {link} {path/hashtag} > {filename}
+```
+You can change `@aria2` with `@aria`, both works. Both the `path/hashtag` and `filename` is optional. This command was made to avoid hassle writing this:
+```
+aria2c --summary-interval=1 --console-log-level=error -c -x 16 -s 16 -k 1M {link} -d {path} -o {filename}
+```
+There are several ways to use it. Here i use a [20MB download test file](http://212.183.159.230/20MB.zip) as an example.
+```
+@aria2 http://212.183.159.230/20MB.zip
+```
+☝️ This will download the file into the current directory (where the hashtags points to). So if before that line you use `#vae`, it will be downloaded to the vae directory. If there are no hashtags before, it'll be sent to the default `#model` directory. The filename will be the last part of the link (`512MB.zip`).
+```
+@aria2 http://212.183.159.230/20MB.zip #vae
+```
+☝️ This will download the file into where `#vae` points to (which is the vae directory). You can use custom hashtag here as well.
+```
+@aria2 http://212.183.159.230/20MB.zip /content/stable-diffusion-webui
+```
+☝️ This will download the file into the written path, which is _/content/stable-diffusion-webui_. Make sure it is a folder path, not a file path.
+```
+@aria2 http://212.183.159.230/20MB.zip /content/stable-diffusion-webui > 20megabytes.zip
+```
+☝️ This will download the file into the written path and rename the file into `20megabytes.zip`. Remember to make sure to write the extension too.
+
+## Gradio Queue
+
+If you use --gradio-queue argument on `launch.py`, some feature will be activated.
+
+### Logging
+
+
+Enable logging by pressing the `Turn On Logging` radio button, and wait till `Logging activated` shows up and the box is blinking with orange border. Logging will tell you what are you actually downloading right now on the webui. After your download session is completed, it's recommended to turn back off the feature.
+
+
+### Cancel
+Pressing `cancel` button while download in progress will stops the current session. Useful when at one time the download speeds is too slow. If you're currently downloading a single item, that item will be cancelled, but the other downloaded one will remain intact.
+
+
+### Progress Bar
+There will be an additional progress bar that tells you the current activities.
+
+
+### Changes if `--gradio-queue` is off
+Feature listed above will dissapear, and your only option for download is just `aria2` (speed is priority).
Note that when you pressed the `Download All!` button, **nothing will shows up on the UI**. You need to check the colab console.
+

+Another thing to note is your download session will always be cutted every 70 seconds (to prevent hangs/desync).
+
+Don't worry, you can continue your session by pressing the `Resume Download` button. It will refresh the links with the one you haven't downloaded yet, then pressing `Download All!` will download the remaining links.
+
+
+## Other Features
+
+### Notification
+
+This extension will play sound effect when the download process is completed. It's somewhat buggy at the moment though.
+
+### Copy From Pastebin
+
+You can put your links on pastebin (write it the way you wrote on Batchlinks), put the pastebin link (https://pastebin.com/xxxx) on the link input, and press the 'Copy from Pastebin' button. It will copy all the the links on the pastebin to the UI. Useful to avoid hassle copy and pasting a bunch of text while on mobile.
+
+
+### SDless mode
+This mode will run the extension without the need of stable-diffusion-webui. Good for my own purpose of debugging it😁.
+
+
+Copy-paste this on a new colab cell then run it:
+```
+from IPython.display import clear_output
+!pip3 show virtualenv >/dev/null || pip install -q virtualenv
+![ -d gradiovenv ] || virtualenv gradiovenv
+!git clone https://github.com/etherealxx/batchlinks-webui \
+/content/stable-diffusion-webui/extensions/batchlinks-webui
+pip3 show gradio >/dev/null || pip install -q gradio==3.16.2; \
+pip3 show tqdm >/dev/null || pip3 install -q tqdm
+clear_output(wait=True)
+!source gradiovenv/bin/activate; \
+python /content/stable-diffusion-webui/extensions/batchlinks-webui/scripts/batchlinks-downloader.py
+```
+or here's the quicker version without venv:
+```
+!pip install gradio==3.16.2
+!git clone https://github.com/etherealxx/batchlinks-webui /content/stable-diffusion-webui/extensions/batchlinks-webui
+!python /content/stable-diffusion-webui/extensions/batchlinks-webui/scripts/batchlinks-downloader.py
+```
+
+For Windows, run the sdless-windows.bat. Make sure you have `python3` and `gradio` package version 3.16.2 or above. It won't use venv.
+
+This one for MacOS. Tested on Mojave. Create a shell script and give execute access to it.
+```
+#!/usr/bin/env bash
+pip3 show virtualenv >/dev/null || pip3 install virtualenv
+[ -d gradiovenv ] || virtualenv gradiovenv
+git clone https://github.com/etherealxx/batchlinks-webui \
+$HOME/Downloads/stable-diffusion-webui/extensions/batchlinks-webui
+source gradiovenv/bin/activate; \
+pip3 show gradio >/dev/null || pip3 install gradio==3.16.2; \
+pip3 show tqdm >/dev/null || pip3 install -q tqdm
+source gradiovenv/bin/activate; \
+python3 $HOME/Downloads/stable-diffusion-webui/extensions/batchlinks-webui/scripts/batchlinks-downloader.py
+```
+
+### Local Installation Support
+
+This extension was tested to work on Windows 11. But ultimately, the number one priority for me is colab use, so there's might be bugs on Windows 11 one. Maybe also works on Debian-based linux (but you better inspect the source code first).
+On Windows, this extension will install [MEGAcmd](https://github.com/meganz/MEGAcmd) for MEGA file download, [wget-windows](https://github.com/webfolderio/wget-windows) for download using `wget`, [aria2-static-builds](https://github.com/q3aql/aria2-static-builds) for download using `aria2`, [7zr and 7z](https://www.7-zip.org) for extracting `aria2` installation, and for `@extract` command.
+MacOS is just partially supported.
+
+Also remember, in order for this extension to work properly, you need make sure that you tick that `add Python 3.10 to PATH` checkbox when you installed Python (Which is already recommended when installing stable-diffusion-webui)
+
+
+### Debug Mode (Developer only)
+
+By manually switching `globaldebug = False` to `True` on the source code, or using `--debug` argument when running the sdless mode, the Debug Mode will be activated. It shows every `print` calls i use to track variables. It will also tracks every files on the models (etc.) paths into a `snapshot.txt` file (if there isn't one).
+
+There are some batchlinks syntax features that only available on debug mode (putting it on the textbox and click `Download All!`):
+
+`@debugresetdownload` - This command will check every model (etc.) directory, and remove every file that isn't on `snapshot.txt`. Useful for me to removes file quickly when testing. **Be careful using this on your local installation.**
+
+`@debugresetdownload` - This command is (supposed to) download a single link with every method available (gdown, curl, wget, aria2), but now i rarely use this command, and haven't updated since. Might be buggy.
+
+## Release Notes
+Moved [here](https://github.com/etherealxx/batchlinks-webui/blob/main/releasenotes.md). Check it out for latest features & bug fixes.
+
+## Roadmap
+
+- [ ] Add checker for downloaded models (so that it won't download again after the model is downloaded)
+- [ ] Different UI for mobile
+- [ ] Gradio progress bar
+- [ ] Integrating refresh button (`create_refresh_button`) to refresh models etc. all at once
+- [ ] Logo change
+- [ ] Moving most of the content of this `Readme.md` to Wiki instead
+- [ ] Other download sites (s-ul.eu, gitgud, bunkr.ru, icedrive)
+- [ ] Separate 'download' and 'run command' function with a subtab
+- [ ] Support download MEGA and Google Drive folder
+- [ ] Using `yield` instead of gradio's `every`
+- [ ] Youtube video (Tutorial)
+- [ ] (Crawler) Download every sd-webui related file from a huggingface repo
+- [ ] (Crawler) Download every model from a civitai user page
+
_
+- [x] aria2 for huggingface download method
+- [x] Cleaning the code from unnecesarry comments
+- [x] Completed download will use the webui's notification.mp3
+- [x] Support customizable hashtag from the UI
+- [x] Supports Windows local installation
+- [x] UI overhaul
+- [x] Using threading/subprocess instead of os.system to download files
+- [x] (Windows) wget & aria2 support
+
+## Known Bugs
+
+- Progress bar (the yellow bar) doesn't progress as expected
+- Sometimes notification sound doesn't play when downloading same file twice in a row
+- Sometimes notification sound shows up when starting download, instead of when the download process is completed.
+- There's still a chance that the UI of non `--gradio-queue` session and/or onedotsix freezes after a download session
+- Windows: The delay between file is downloaded and the output shows is pretty long, and even sometimes the notification comes at the wrong time.
+
+
+### Known Fixed Bugs
+
+
+ 👈Fixed Bugs
+
+
+ Links that has bracket in it needs to be 'escaped' (For example, Baka-DiffusionV1(Fp16).safetensors
must be typed Baka-DiffusionV1\(Fp16\).safetensors
)
☝️Fixed in v2.0.0
+ The delay between file is downloaded and the output shows is really long (1min+) on camenduru's v1.6 colab (Gradio related?)
☝️Seems like fixed in v1.1.0
+ File downloaded from MEGA will not listed on the output, as it use different download method. There is some delay between the transfare() function complete until it writes the file. I don't know how long the delay is.
☝️Fixed in v1.1.0
+ Sometimes colab cannot be shut down with a single click on the stop button. Hitting the button several times will raise a KeyboardInterrupt and forcely stopping the cell.
☝️Seems like fixed somewhere on v3.0.0 and after
+
+
+
+
+## Contributing
+
+
+
+[I no longer actively maintain this project](https://github.com/etherealxx/batchlinks-webui/blob/main/regardingthisrepo.md). if you have a suggestion or code-fixing that would make this better, please notify me in the issue tab, fork the repo and create a pull request.
+But still, a star on this project would be nice. Thanks again.
+
+
+
+## Contact
+
+My Email - gwathon3@gmail.com
+My Youtube - [MJ Devlog](https://www.youtube.com/@mjdevlog)
+
+## Acknowledgments
+
+- [Camenduru's Webui Huggingface](https://github.com/camenduru/stable-diffusion-webui-huggingface) - I use his extension as my base (my gradio skill sucks T.T)
+- [SD Civitai Browser](https://github.com/Vetchems/sd-civitai-browser) - Civit download script
+- [Mega-to-Google-Drive](https://github.com/menukaonline/Mega-to-Google-Drive) - MEGA download script
+- [MEGAcmd](https://github.com/meganz/MEGAcmd)
+- [mediafire-dl](https://github.com/Juvenal-Yescas/mediafire-dl)
+- [Pixeldrain downloader](https://github.com/FayasNoushad/Pixeldrain) - Inspiration for Pixeldrain download method
+- [wget-windows](https://github.com/webfolderio/wget-windows)
+- [aria2-static-builds](https://github.com/q3aql/aria2-static-builds)
+- [7zr, 7z](https://www.7-zip.org)
diff --git a/Jac12/extensions/batchlinks-webui-main/howtogetthedirectlinks.md b/Jac12/extensions/batchlinks-webui-main/howtogetthedirectlinks.md
new file mode 100644
index 0000000000000000000000000000000000000000..f7387a794f4dbde713f74f1e5e7f45c92000cc4e
--- /dev/null
+++ b/Jac12/extensions/batchlinks-webui-main/howtogetthedirectlinks.md
@@ -0,0 +1,104 @@
+# How to get the direct links
+
+Jump to: [Huggingface](https://github.com/etherealxx/batchlinks-webui/blob/main/howtogetthedirectlinks.md#huggingface) - [Civit AI](https://github.com/etherealxx/batchlinks-webui/blob/main/howtogetthedirectlinks.md#civit-ai) - [MEGA](https://github.com/etherealxx/batchlinks-webui/blob/main/howtogetthedirectlinks.md#mega) - [Discord](https://github.com/etherealxx/batchlinks-webui/blob/main/howtogetthedirectlinks.md#discord-attachments) - [Github (Extension)](https://github.com/etherealxx/batchlinks-webui/blob/main/howtogetthedirectlinks.md#webui-extension-github-repo-link) - [Github (Raw File)](https://github.com/etherealxx/batchlinks-webui/blob/main/howtogetthedirectlinks.md#raw-file-from-github) - [Github (Release File)](https://github.com/etherealxx/batchlinks-webui/blob/main/howtogetthedirectlinks.md#release-file-from-github) - [Google Drive](https://github.com/etherealxx/batchlinks-webui/blob/main/howtogetthedirectlinks.md#google-drive) - [Pixeldrain](https://github.com/etherealxx/batchlinks-webui/blob/main/howtogetthedirectlinks.md#pixeldrain) - - [Mediafire](https://github.com/etherealxx/batchlinks-webui/blob/main/howtogetthedirectlinks.md#mediafire) - [Anonfiles](https://github.com/etherealxx/batchlinks-webui/blob/main/howtogetthedirectlinks.md#anonfiles) - [Dropbox](https://github.com/etherealxx/batchlinks-webui/blob/main/howtogetthedirectlinks.md#dropbox)
+
+## Huggingface
+
+Locate the model page, click on `files` tab.
+
+choose the model you want, **right click** the arrow button beside the LFS logo, then click `copy link address`.
+
+
+## Civit AI
+
+There are two ways to download links from Civit. The model page link method, and the direct link method. The model page link method **will automatically** choose the directory of the saved model without even using hashtag, **except** if you want to put Lora into `#addnetlora` directory, you can use that hashtag. You still need to define the output directory when using the direct link method.
+
+### Model Page Link Method
+
+Locate the desired model on the main page of Civitai, **right click** the model thumbnail, then click `copy link address`.
+
+You can also click the thumbnail first then copy the link.
+
+The advantage of this method is you will also get the model preview images that can shows up on the latest version of [stable-diffusion-webui](https://github.com/AUTOMATIC1111/stable-diffusion-webui).
+
+### Direct Link Method
+
+Locate the model page, **right click** the huge blue button, then click `copy link address`.
+
+With this method, you can also choose model variation, by clicking the dropdown icon on the blue button, then **right click** the desired model an.
+
+
+## MEGA
+
+Locate the model you wanted, **right click** the item, click `copy link address`.
+
+Click the huge green copy button.
+
+
+## Discord attachments
+
+Locate the file you wanted, **right click** the download icon, then click `get link`.
+
+Then click `copy link`.
+
+
+## webui Extension (Github repo link)
+
+Locate the extension's repository, then copy the repository link.
+
+
+Extension **will automatically** cloned/downloaded on `extensions` directory of webui without the need of hashtag.
+
+## Raw file from Github
+
+Locate the file's repository, then click the desired file.
+
+Then **right click** the text that says `raw` **or** `download`, and click `copy link address`
+
+
+
+## Release file from Github
+
+Locate the file's repository, then click release section.
+
+Then **right click** the desired assets (the blue text), and click `copy link address`
+
+
+## Google Drive
+
+Whether you own the file or not, make sure the file is public. If you owns the file, right click on the file on Google Drive, then click `get link` (or `share`).
+
+Then change the access to `anyone with thelink`, and copy the link by clicking the button
+
+
+These are some valid google drive link patterns that works:
+```
+https://drive.google.com/file/d/1-UbwFtSzKTQkvjdPiKLCejH0Ztq9UJFO/view
+https://drive.google.com/file/d/1-UbwFtSzKTQkvjdPiKLCejH0Ztq9UJFO/view?usp=share_link
+https://drive.google.com/u/0/uc?id=1-UbwFtSzKTQkvjdPiKLCejH0Ztq9UJFO&export=download
+https://drive.google.com/u/0/uc?id=1-UbwFtSzKTQkvjdPiKLCejH0Ztq9UJFO&export=download&confirm=t
+```
+## Pixeldrain
+
+Just click the `copy link` button, or just copy the link.
+
+
+## Anonfiles
+
+**Don't** right click the download button. Instead, copy the link on the url bar
+
+
+## Mediafire
+
+When you arrived on this page, click the chain link icon to copy link, or just copy the link above
+
+
+Don't forget that when being pasted, the link must starts with `https://www.mediafire.com/file/` (notice the triple W)
+
+## Dropbox
+
+When the item is yours, go to the homepage, and click copy link, the link will be copied to your clipboard
+
+
+Or, if you got into this screen, just copy the link above, with the link ends with either `?dl=0` or `?dl=1`
+
\ No newline at end of file
diff --git a/Jac12/extensions/batchlinks-webui-main/images/anonfiles.png b/Jac12/extensions/batchlinks-webui-main/images/anonfiles.png
new file mode 100644
index 0000000000000000000000000000000000000000..be3c235889bdd8675ebeb1b8493f398e00fc0b63
--- /dev/null
+++ b/Jac12/extensions/batchlinks-webui-main/images/anonfiles.png
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:81762605f909b765261477b576eb54c2a82c392d46f9586c6a5ee0593540e20f
+size 94665
diff --git a/Jac12/extensions/batchlinks-webui-main/images/batchlinks_logo.png b/Jac12/extensions/batchlinks-webui-main/images/batchlinks_logo.png
new file mode 100644
index 0000000000000000000000000000000000000000..95719a72888109b1cd903c54ba5726cfc1cda31c
--- /dev/null
+++ b/Jac12/extensions/batchlinks-webui-main/images/batchlinks_logo.png
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:01d8c6884a8193e7c5158a133bae294205561f8f42c3c9111d22ad6121944d58
+size 69338
diff --git a/Jac12/extensions/batchlinks-webui-main/images/cancel.jpg b/Jac12/extensions/batchlinks-webui-main/images/cancel.jpg
new file mode 100644
index 0000000000000000000000000000000000000000..95e481911de14624934727839457617fa66cce6a
--- /dev/null
+++ b/Jac12/extensions/batchlinks-webui-main/images/cancel.jpg
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:e6bd34ef949fb6e5e5cc754444872a11a06ac91e5e3791788b90c2b4e4069d45
+size 38628
diff --git a/Jac12/extensions/batchlinks-webui-main/images/checkconsole1.jpg b/Jac12/extensions/batchlinks-webui-main/images/checkconsole1.jpg
new file mode 100644
index 0000000000000000000000000000000000000000..523843d51c75714743a81af7dd1250ee445c7171
--- /dev/null
+++ b/Jac12/extensions/batchlinks-webui-main/images/checkconsole1.jpg
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:86374d5488bd1e2dc945170f38908c1ba5467618a73f9b746dda6380158598af
+size 110002
diff --git a/Jac12/extensions/batchlinks-webui-main/images/checkconsole2.jpg b/Jac12/extensions/batchlinks-webui-main/images/checkconsole2.jpg
new file mode 100644
index 0000000000000000000000000000000000000000..00881490bd9311483ec7cbb1a1ae3b7cc905601b
--- /dev/null
+++ b/Jac12/extensions/batchlinks-webui-main/images/checkconsole2.jpg
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:6c9cbc2c9cba207b6195cee0e6f0eaf1bf4e33c1ee6008310ebcc9384e12831a
+size 141766
diff --git a/Jac12/extensions/batchlinks-webui-main/images/civit1.jpg b/Jac12/extensions/batchlinks-webui-main/images/civit1.jpg
new file mode 100644
index 0000000000000000000000000000000000000000..e971da9c637712b46dd3fbd7b21a4f832d9ee8b9
--- /dev/null
+++ b/Jac12/extensions/batchlinks-webui-main/images/civit1.jpg
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:b846b90588b1363a06ff7cd2049a053aae931b8e95e1267ea0d960273abb9ea5
+size 276853
diff --git a/Jac12/extensions/batchlinks-webui-main/images/civit2.jpg b/Jac12/extensions/batchlinks-webui-main/images/civit2.jpg
new file mode 100644
index 0000000000000000000000000000000000000000..dfb1c6735c5d7950d224d86e0095f043bae485cf
--- /dev/null
+++ b/Jac12/extensions/batchlinks-webui-main/images/civit2.jpg
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:022e9983f462512527875eb05966149c74f9fdc25a10e89d2b9d66d0c9cc48c3
+size 354651
diff --git a/Jac12/extensions/batchlinks-webui-main/images/civitnew1.jpg b/Jac12/extensions/batchlinks-webui-main/images/civitnew1.jpg
new file mode 100644
index 0000000000000000000000000000000000000000..fddbac81ee6f03005815ef0c81cea65f66eaed82
--- /dev/null
+++ b/Jac12/extensions/batchlinks-webui-main/images/civitnew1.jpg
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:6471a911d1fa71f0e52bfee658acc90f183415abae31df82f6965610acdbd6ff
+size 114523
diff --git a/Jac12/extensions/batchlinks-webui-main/images/civitnew2.jpg b/Jac12/extensions/batchlinks-webui-main/images/civitnew2.jpg
new file mode 100644
index 0000000000000000000000000000000000000000..ce45541d1f6b1687cec7dada15bb58353dfda061
--- /dev/null
+++ b/Jac12/extensions/batchlinks-webui-main/images/civitnew2.jpg
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:6d4d31342e7245e56a58d01001a7a54de17e778976d96a83cefc99fe98efd398
+size 152587
diff --git a/Jac12/extensions/batchlinks-webui-main/images/discord1.jpg b/Jac12/extensions/batchlinks-webui-main/images/discord1.jpg
new file mode 100644
index 0000000000000000000000000000000000000000..07b0ff48791f7899d605fd31b53f6983f873723a
--- /dev/null
+++ b/Jac12/extensions/batchlinks-webui-main/images/discord1.jpg
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:9e3dfa6e4f938c7425394d91fad685277c150b8cca67a418c53a8f4e6545a535
+size 221787
diff --git a/Jac12/extensions/batchlinks-webui-main/images/discord2.jpg b/Jac12/extensions/batchlinks-webui-main/images/discord2.jpg
new file mode 100644
index 0000000000000000000000000000000000000000..cf2fffa59abf4effce9d9a7270f27113ad33aef3
--- /dev/null
+++ b/Jac12/extensions/batchlinks-webui-main/images/discord2.jpg
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:ed1cefc671f818413caf6b036c3d52b70a8eb061e61ad452a25086df6ecff3ae
+size 281917
diff --git a/Jac12/extensions/batchlinks-webui-main/images/downloaded.jpg b/Jac12/extensions/batchlinks-webui-main/images/downloaded.jpg
new file mode 100644
index 0000000000000000000000000000000000000000..3d930b656e4dd422ec1570caff92b66720d714c1
--- /dev/null
+++ b/Jac12/extensions/batchlinks-webui-main/images/downloaded.jpg
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:5826e8f877ee50514d140d8eb61132ef60e5d328be8e1622120272cfc2ec1858
+size 135221
diff --git a/Jac12/extensions/batchlinks-webui-main/images/drive1.png b/Jac12/extensions/batchlinks-webui-main/images/drive1.png
new file mode 100644
index 0000000000000000000000000000000000000000..878e9d0a20b2b27bf296d9a885609ab6afb875b1
--- /dev/null
+++ b/Jac12/extensions/batchlinks-webui-main/images/drive1.png
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:51f986ee3eb2bc01640d10abe7ae44a0ccf62882007aa606fd8d05d31d2011a8
+size 25485
diff --git a/Jac12/extensions/batchlinks-webui-main/images/drive2.png b/Jac12/extensions/batchlinks-webui-main/images/drive2.png
new file mode 100644
index 0000000000000000000000000000000000000000..f18d1171dc715f72e41da452aa205edfbe5b4d3d
--- /dev/null
+++ b/Jac12/extensions/batchlinks-webui-main/images/drive2.png
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:e6304bb05d9a69781db90c5cfd7b6bde378b4c413592a87aa9bfae35a47b0d8d
+size 67395
diff --git a/Jac12/extensions/batchlinks-webui-main/images/dropbox1.png b/Jac12/extensions/batchlinks-webui-main/images/dropbox1.png
new file mode 100644
index 0000000000000000000000000000000000000000..01240c3f7de724d953e1b963c02a4ef5e1372574
--- /dev/null
+++ b/Jac12/extensions/batchlinks-webui-main/images/dropbox1.png
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:250137edcce0a3a64fccd94d866e139d0f1c3a27c3e05a6bfa5f98a06f6f8b41
+size 36700
diff --git a/Jac12/extensions/batchlinks-webui-main/images/dropbox2.png b/Jac12/extensions/batchlinks-webui-main/images/dropbox2.png
new file mode 100644
index 0000000000000000000000000000000000000000..79b2d880b3212d55cafe6535a0bcbdc5e53ea495
--- /dev/null
+++ b/Jac12/extensions/batchlinks-webui-main/images/dropbox2.png
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:9f4afaac83c68dd9a7fa4e20fc1b65b663ca8b9fbf3ca68d4d318616d09d60aa
+size 24753
diff --git a/Jac12/extensions/batchlinks-webui-main/images/example.jpg b/Jac12/extensions/batchlinks-webui-main/images/example.jpg
new file mode 100644
index 0000000000000000000000000000000000000000..5d5f576aeac78b1cf19eafee5e45dcfac11ace69
--- /dev/null
+++ b/Jac12/extensions/batchlinks-webui-main/images/example.jpg
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:667daae167da164a85deec0d81cc82eb0f9c97d5fc60f5b1afdd574d8a3406a2
+size 305239
diff --git a/Jac12/extensions/batchlinks-webui-main/images/ext_installer.jpg b/Jac12/extensions/batchlinks-webui-main/images/ext_installer.jpg
new file mode 100644
index 0000000000000000000000000000000000000000..5fb71b3576d4d7e302cda019e6c525ceb853f2b6
--- /dev/null
+++ b/Jac12/extensions/batchlinks-webui-main/images/ext_installer.jpg
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:f408f248237131cc2d846e6b8b923e7dea7f4e2c734a5638ad85a717ece4e568
+size 81465
diff --git a/Jac12/extensions/batchlinks-webui-main/images/github.jpg b/Jac12/extensions/batchlinks-webui-main/images/github.jpg
new file mode 100644
index 0000000000000000000000000000000000000000..5d43d829e9ea8c3393efbc4ea8b538260f40fa1e
--- /dev/null
+++ b/Jac12/extensions/batchlinks-webui-main/images/github.jpg
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:ea289b6ddbfeb28624ec47513a73b85beee06f4fd3dd5a4d8bc4482d6ed36ecd
+size 130743
diff --git a/Jac12/extensions/batchlinks-webui-main/images/githubdirect1.png b/Jac12/extensions/batchlinks-webui-main/images/githubdirect1.png
new file mode 100644
index 0000000000000000000000000000000000000000..d3d6ae1d2efc3e92b39d35d30fecb373f4bf2c29
--- /dev/null
+++ b/Jac12/extensions/batchlinks-webui-main/images/githubdirect1.png
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:617ac0556ab4caf0c7313694628199f1a33f9e6fa24b667c85294ff5404964c0
+size 48222
diff --git a/Jac12/extensions/batchlinks-webui-main/images/githubdirect2.png b/Jac12/extensions/batchlinks-webui-main/images/githubdirect2.png
new file mode 100644
index 0000000000000000000000000000000000000000..a912351969267e061c865b86bf4429be08327aee
--- /dev/null
+++ b/Jac12/extensions/batchlinks-webui-main/images/githubdirect2.png
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:472a22bfbb0daa15dfef5fa021bebd386300407fc7fff6ec034dc97c5522cec9
+size 29464
diff --git a/Jac12/extensions/batchlinks-webui-main/images/githubdirect3.png b/Jac12/extensions/batchlinks-webui-main/images/githubdirect3.png
new file mode 100644
index 0000000000000000000000000000000000000000..a5fef064b85a9818194cd14dc71ec8ddc54d63c0
--- /dev/null
+++ b/Jac12/extensions/batchlinks-webui-main/images/githubdirect3.png
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:a36eb714cc6fc5d94a899e1345477fb8c8a6738e1aefb267ab681aea06621eef
+size 32174
diff --git a/Jac12/extensions/batchlinks-webui-main/images/githubrelease1.png b/Jac12/extensions/batchlinks-webui-main/images/githubrelease1.png
new file mode 100644
index 0000000000000000000000000000000000000000..a9a2d47be14c271cee731b6beb52bc2b93deb711
--- /dev/null
+++ b/Jac12/extensions/batchlinks-webui-main/images/githubrelease1.png
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:aaa04375d0e27bcc59a9bc0268b57409f5c56ac22d844641c355d9b4f9b32017
+size 108011
diff --git a/Jac12/extensions/batchlinks-webui-main/images/githubrelease2.png b/Jac12/extensions/batchlinks-webui-main/images/githubrelease2.png
new file mode 100644
index 0000000000000000000000000000000000000000..bc1ec1df56709cc3ce5a936279c8ddd3167032f5
--- /dev/null
+++ b/Jac12/extensions/batchlinks-webui-main/images/githubrelease2.png
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:b2ea62826c3d67d84581b923ab8bfe50b60fd2d31edde642ec39eae80bb23760
+size 48260
diff --git a/Jac12/extensions/batchlinks-webui-main/images/gradiooff1.jpg b/Jac12/extensions/batchlinks-webui-main/images/gradiooff1.jpg
new file mode 100644
index 0000000000000000000000000000000000000000..df3d2a4f25e74df1dcd0b3849a9b9a8089f152ee
--- /dev/null
+++ b/Jac12/extensions/batchlinks-webui-main/images/gradiooff1.jpg
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:1c2b9f041c0df0b027583313f4f5df8ffa69f4b2867998cb2dd0597421ad23af
+size 120495
diff --git a/Jac12/extensions/batchlinks-webui-main/images/gradiooff2.jpg b/Jac12/extensions/batchlinks-webui-main/images/gradiooff2.jpg
new file mode 100644
index 0000000000000000000000000000000000000000..f89d6714b130e2902d763aec65d3f9848de2efc3
--- /dev/null
+++ b/Jac12/extensions/batchlinks-webui-main/images/gradiooff2.jpg
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:5afa84326d4707b2302594023b88dcdd4922ad2f78bf68d6d100ed18b6c659b9
+size 164324
diff --git a/Jac12/extensions/batchlinks-webui-main/images/huggingface1.jpg b/Jac12/extensions/batchlinks-webui-main/images/huggingface1.jpg
new file mode 100644
index 0000000000000000000000000000000000000000..7a9aac136d84d9e3e79248201958f53ee87a5883
--- /dev/null
+++ b/Jac12/extensions/batchlinks-webui-main/images/huggingface1.jpg
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:15d43e32af58d99b618c88c4db9b360a06b1f01eb8caa4b712c8c6c691007e05
+size 181813
diff --git a/Jac12/extensions/batchlinks-webui-main/images/huggingface2.jpg b/Jac12/extensions/batchlinks-webui-main/images/huggingface2.jpg
new file mode 100644
index 0000000000000000000000000000000000000000..e7c1ffacb8a9673d56736ca8122eafba9b9b0a99
--- /dev/null
+++ b/Jac12/extensions/batchlinks-webui-main/images/huggingface2.jpg
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:aeb5118fd4f11cce6b4101e3cfa87b319e122577c02f09369777f7cdaaecabf3
+size 246039
diff --git a/Jac12/extensions/batchlinks-webui-main/images/logging.jpg b/Jac12/extensions/batchlinks-webui-main/images/logging.jpg
new file mode 100644
index 0000000000000000000000000000000000000000..c857c69e9e578b81ae22ef21b70b6e9542fa4185
--- /dev/null
+++ b/Jac12/extensions/batchlinks-webui-main/images/logging.jpg
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:11da4c09501c4aa58cb835982e515f82e18e0790ca859add366461b5293bb445
+size 64446
diff --git a/Jac12/extensions/batchlinks-webui-main/images/mediafire.png b/Jac12/extensions/batchlinks-webui-main/images/mediafire.png
new file mode 100644
index 0000000000000000000000000000000000000000..3e56baecdd2ac4d078ba3003b95f6cfd65b95948
--- /dev/null
+++ b/Jac12/extensions/batchlinks-webui-main/images/mediafire.png
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:9d78181c735d75e167d89ba79a6c5a48c839f29d2227c05797f32159b9620ff0
+size 100180
diff --git a/Jac12/extensions/batchlinks-webui-main/images/mega1.jpg b/Jac12/extensions/batchlinks-webui-main/images/mega1.jpg
new file mode 100644
index 0000000000000000000000000000000000000000..8ca89ee59b464d8fce0b4822177834a1eac6e7d1
--- /dev/null
+++ b/Jac12/extensions/batchlinks-webui-main/images/mega1.jpg
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:1ef3e160387c9fcfd7c93718a66a62303e7e33d65ab35a44631d0724883370d2
+size 324912
diff --git a/Jac12/extensions/batchlinks-webui-main/images/mega2.jpg b/Jac12/extensions/batchlinks-webui-main/images/mega2.jpg
new file mode 100644
index 0000000000000000000000000000000000000000..dbc8bd0a3d2a1f0c014c32ff7b8623bca29c9d2b
--- /dev/null
+++ b/Jac12/extensions/batchlinks-webui-main/images/mega2.jpg
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:2cdbd02fe77fd30d0255b865bf815ecc3555cdaccec092f90748c9e1c83603e9
+size 276778
diff --git a/Jac12/extensions/batchlinks-webui-main/images/pastebin.png b/Jac12/extensions/batchlinks-webui-main/images/pastebin.png
new file mode 100644
index 0000000000000000000000000000000000000000..70c62759d746fc867bfcb84a297f08904154db3c
--- /dev/null
+++ b/Jac12/extensions/batchlinks-webui-main/images/pastebin.png
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:e3a98e4da5ab0fd87bf9fa9ebd1ca0cc439c3b8ca12bc7f1f3045e78ba92d09e
+size 88513
diff --git a/Jac12/extensions/batchlinks-webui-main/images/pixeldrain.png b/Jac12/extensions/batchlinks-webui-main/images/pixeldrain.png
new file mode 100644
index 0000000000000000000000000000000000000000..ea1a3ab02b0452fdf3db1d58d6484ddd27c6a3d6
--- /dev/null
+++ b/Jac12/extensions/batchlinks-webui-main/images/pixeldrain.png
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:a1b4432475cffc9768dff806a3666099078e6d3f44f72d580256b223bf556ab8
+size 227760
diff --git a/Jac12/extensions/batchlinks-webui-main/images/progress.jpg b/Jac12/extensions/batchlinks-webui-main/images/progress.jpg
new file mode 100644
index 0000000000000000000000000000000000000000..fcc1d49a8c29d097ccaa244f0f42c4754334cd56
--- /dev/null
+++ b/Jac12/extensions/batchlinks-webui-main/images/progress.jpg
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:966b782082062965ed63098661bc295dd3ed4312916f972cff6249fed227581c
+size 26904
diff --git a/Jac12/extensions/batchlinks-webui-main/images/python.png b/Jac12/extensions/batchlinks-webui-main/images/python.png
new file mode 100644
index 0000000000000000000000000000000000000000..c0354be86b068c46ccb12d54b3c0f71b279ce41b
--- /dev/null
+++ b/Jac12/extensions/batchlinks-webui-main/images/python.png
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:8c4fd48ec3ed8553b058d9df807c02ed712a0e21b22cce212a74018a976d2074
+size 165127
diff --git a/Jac12/extensions/batchlinks-webui-main/images/queue.jpg b/Jac12/extensions/batchlinks-webui-main/images/queue.jpg
new file mode 100644
index 0000000000000000000000000000000000000000..93de9b05ea2797eaed3cde5f303ced8b7ee5ab43
--- /dev/null
+++ b/Jac12/extensions/batchlinks-webui-main/images/queue.jpg
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:0be2bdb19ee7e60688d6a685e0493da86aaf1d3dafda1493c5e84b8f77a14bea
+size 9578
diff --git a/Jac12/extensions/batchlinks-webui-main/images/rename.jpg b/Jac12/extensions/batchlinks-webui-main/images/rename.jpg
new file mode 100644
index 0000000000000000000000000000000000000000..69443aede5c03a35d78e2444f561e49fd9f2fd5b
--- /dev/null
+++ b/Jac12/extensions/batchlinks-webui-main/images/rename.jpg
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:7a76c383bfdee8d908f8281225690a939db22ae7ef4414948f5fb6cb4e657250
+size 33389
diff --git a/Jac12/extensions/batchlinks-webui-main/images/sdless.png b/Jac12/extensions/batchlinks-webui-main/images/sdless.png
new file mode 100644
index 0000000000000000000000000000000000000000..61165a8114eb2a36c237723c129e0304030f06b5
--- /dev/null
+++ b/Jac12/extensions/batchlinks-webui-main/images/sdless.png
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:8defc9b1b301985d5fa522e167a4fbf163c70b624356bf3279aef4ddf1044f52
+size 26202
diff --git a/Jac12/extensions/batchlinks-webui-main/images/shell1.jpg b/Jac12/extensions/batchlinks-webui-main/images/shell1.jpg
new file mode 100644
index 0000000000000000000000000000000000000000..15dc624f2798276cf001d507ce93d235e86dd2ea
--- /dev/null
+++ b/Jac12/extensions/batchlinks-webui-main/images/shell1.jpg
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:d76e5e92ce7479b602eba2a4f00063e537689403e29cfc460178981014313d49
+size 13227
diff --git a/Jac12/extensions/batchlinks-webui-main/images/shell2.jpg b/Jac12/extensions/batchlinks-webui-main/images/shell2.jpg
new file mode 100644
index 0000000000000000000000000000000000000000..0910f1c888780277544880f358ec9c3f5818985e
--- /dev/null
+++ b/Jac12/extensions/batchlinks-webui-main/images/shell2.jpg
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:5a46c7e0d687a8318177a983ee27a67b864bc897f2810e000fab7d8d20d532eb
+size 13956
diff --git a/Jac12/extensions/batchlinks-webui-main/install.py b/Jac12/extensions/batchlinks-webui-main/install.py
new file mode 100644
index 0000000000000000000000000000000000000000..e7b31a25c27a092c849474ab35aa3ab1130ab210
--- /dev/null
+++ b/Jac12/extensions/batchlinks-webui-main/install.py
@@ -0,0 +1,9 @@
+import launch
+import platform
+
+if platform.system() == "Windows":
+ if not launch.is_installed("gdown"):
+ launch.run_pip("install gdown", "requirements for Batchlinks Download extension")
+
+ if not launch.is_installed("wget"):
+ launch.run_pip("install wget", "requirements for Batchlinks Download extension")
\ No newline at end of file
diff --git a/Jac12/extensions/batchlinks-webui-main/javascript/notification.js b/Jac12/extensions/batchlinks-webui-main/javascript/notification.js
new file mode 100644
index 0000000000000000000000000000000000000000..8339d3093e0d307db66de30999803862cca01275
--- /dev/null
+++ b/Jac12/extensions/batchlinks-webui-main/javascript/notification.js
@@ -0,0 +1,19 @@
+let prevTextAreaValue = '';
+let isTextAreaVisible = true;
+
+onUiUpdate(function() {
+ const textArea = gradioApp().querySelectorAll('#tab_batchlinks textarea')?.[2];
+ const textAreaValue = textArea ? textArea.value : '';
+
+ if (isTextAreaVisible && textAreaValue.startsWith('All done!') && prevTextAreaValue !== textAreaValue) {
+ gradioApp().querySelector('#finish_audio audio')?.play();
+ }
+
+ if (!textArea) {
+ isTextAreaVisible = false;
+ } else if (textArea.style.display !== 'none') {
+ isTextAreaVisible = true;
+ }
+
+ prevTextAreaValue = textAreaValue;
+});
diff --git a/Jac12/extensions/batchlinks-webui-main/misc/markydynamictohtml.py b/Jac12/extensions/batchlinks-webui-main/misc/markydynamictohtml.py
new file mode 100644
index 0000000000000000000000000000000000000000..09ea8b1299a9d8ad5e4d2ba4e60748e9b829c5b9
--- /dev/null
+++ b/Jac12/extensions/batchlinks-webui-main/misc/markydynamictohtml.py
@@ -0,0 +1,86 @@
+#tableofcontentmaker
+intro = """
+
+ Table of Contents
+
+"""
+
+outro = """
+
+
+
+"""
+
+tableofcontents = """
+- [Installation](#installation)
+- [About](#about)
+- [Example](#example)
+- [Syntax](#syntax)
+ - [Hashtag](#hashtag)
+ - [Links](#links)
+ - [Double Hashtag](#double-hashtag)
+ - [Others](#others)
+ - [Valid Hashtags](#valid-hashtags)
+ - [How to get the direct links (Important!)](#how-to-get-the-direct-links-important)
+ - [Huggingface's download method](#huggingfaces-download-method)
+- [Additional Syntax](#additional-syntax)
+ - [Rename Downloaded Files](#rename-downloaded-files)
+ - [Running Shell Commands](#running-shell-commands)
+ - [Extract Everyting (`@extract`)](#extract-everyting-extract)
+ - [Custom Hashtag Path (`@new`)](#custom-hashtag-path-new)
+ - [Custom Direct Link Download with `aria2` (`@aria2`)](#custom-direct-link-download-with-aria2-aria2)
+- [Gradio Queue](#gradio-queue)
+ - [Logging](#logging)
+ - [Cancel](#cancel)
+ - [Progress Bar](#progress-bar)
+ - [Changes if `--gradio-queue` is off](#changes-if---gradio-queue-is-off)
+- [Other Features](#other-features)
+ - [Notification](#notification)
+ - [Copy From Pastebin](#copy-from-pastebin)
+ - [SDless mode](#sdless-mode)
+ - [Local Installation Support](#local-installation-support)
+ - [Debug Mode (Developer only)](#debug-mode-developer-only)
+- [Release Notes](#release-notes)
+- [Roadmap](#roadmap)
+- [Known Bugs](#known-bugs)
+ - [Known Fixed Bugs](#known-fixed-bugs)
+- [Contributing](#contributing)
+- [Contact](#contact)
+- [Acknowledgments](#acknowledgments)
+"""
+
+def mlineprint(toprint):
+ if toprint[-1] == '\n':
+ toprint = toprint[:-1]
+ print(toprint.replace('\n', '', 1))
+
+
+def writehtmllist(space, namehead, hashtaghead):
+ spaces = ""
+ for _ in range(space):
+ spaces += " "
+ if initialspace >= 2:
+ return spaces + f''
+ else:
+ return spaces + f'{namehead}'
+
+if __name__ == "__main__":
+ rows = tableofcontents.replace('\n', '', 1).splitlines()#split('\n') # split into a list of rows
+ mlineprint(intro)
+ for row in rows:
+ if not row == '':
+ initialspace = 0
+ for char in row:
+ if char == ' ':
+ initialspace += 1
+ else:
+ break
+ extractedrow = row.split("[")
+ cuttedrow = extractedrow[1].partition("](")
+ headingname = cuttedrow[0]
+ headinghashtag = cuttedrow[2].rstrip(")")
+ print(writehtmllist(initialspace+4, headingname, headinghashtag))
+ # print(cuttedrow[0])
+ # print(cuttedrow[2].rstrip(")"))
+ # hashtagrow = row.partit
+ mlineprint(outro)
diff --git a/Jac12/extensions/batchlinks-webui-main/notification.mp3 b/Jac12/extensions/batchlinks-webui-main/notification.mp3
new file mode 100644
index 0000000000000000000000000000000000000000..72e4be145aca66c6c8d902e23c8093500f324f88
--- /dev/null
+++ b/Jac12/extensions/batchlinks-webui-main/notification.mp3
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:d3b9078c4f8804cbd3817e5d8d873d6fd3dc9c288ecc891958adf73447715fa0
+size 37740
diff --git a/Jac12/extensions/batchlinks-webui-main/regardingthisrepo.md b/Jac12/extensions/batchlinks-webui-main/regardingthisrepo.md
new file mode 100644
index 0000000000000000000000000000000000000000..f576057ca17c5150e1753def4922aacb28a7078d
--- /dev/null
+++ b/Jac12/extensions/batchlinks-webui-main/regardingthisrepo.md
@@ -0,0 +1,14 @@
+#### Dear beloved Batchlinks user,
+
+I want to share with you that I have lost interest in this project/repo. It was a time when I was fully invested in it, spending countless hours fixing bugs, adding new features, and learning Python/Markdown. I remember the excitement of refreshing the notification page on Github to find a new bug report or feature request. It was an addicting experience, and I enjoyed it more than my college studies.
+
+But unfortunately, things have changed, and my mood and interests shift rapidly. I have been into different things throughout my life, such as game development, graphic design, video editing, music creation, gaming, and more. Even though I loved generating images with AI during the early days of stable diffusion, I rarely do it now, since my focus has shifted into this project.
+
+Despite my change in interests, I want to emphasize that I don't want to abandon this project. I have made many friends through this project, and it holds a special place in my heart. However, I just can't continue to give it the same level of attention and dedication that it deserves. I might still do some small bug fixes, but for adding features, maybe not.
+
+I will miss those days of working on this project, but I'm excited to explore new interests in gaming, video editing, and many others. I want to thank camenduru, machiavel, 7743, NUROISEA, NoCrypt, and many other people who supported me on various Discord servers, github issues, and many other places. Also thanks to everyone who has contributed to this project, whether by reporting bug, requesting features, pull request, and many others. And lastly, thank YOU for using this tool. It might just helps you a little, but every single user means A LOT to me.
+
+I hope this continues to thrive and helps people in the future.💖
+
+Best regards,
+MJ
\ No newline at end of file
diff --git a/Jac12/extensions/batchlinks-webui-main/releasenotes.md b/Jac12/extensions/batchlinks-webui-main/releasenotes.md
new file mode 100644
index 0000000000000000000000000000000000000000..d17521bd5222b0b006d419f6b376f3a271be7bf9
--- /dev/null
+++ b/Jac12/extensions/batchlinks-webui-main/releasenotes.md
@@ -0,0 +1,138 @@
+# Release Notes
+
+### Latest Patch: v3.2.1
+- Changed "pruned" option to "fp precision" due to CivitAI API changes
+- Fixed bug: No matter when the download process is cancelled or not, CivitAI download will give print out notification that the download process is successful
+- Fixed bug: Preventing the UI errored out when storage is full and trying to convert jpg image while downloading civitai stuff (PIL.UnidentifiedImageError)
+- UI overhaul
+
+#### Patch: v3.2.0a
+- Added support for [vladmandic's fork of automatic1111's webui](https://github.com/vladmandic/automatic)
+
+## Latest Release: v3.2.0
+- Bug fixed when downloading with aria2 on Windows
+- Bug fixed on gradio update checker on sdless batch file for windows
+- CivitAi error prevention (when the website is down)
+- Cleaned the code of the hashtag system
+- `Copy from Pastebin` feature
+- Custom aria command with `@aria`
+- Making sure custom hashtag doesn't start with number
+- New calmer notification sound
+- Readme page cleanup
+- Some help link changed to link into wiki instead
+- UI fix to adapt with latest gradio (v3.23.0)
+- Various bug fixes related to CivitAI download
+
+#### Release v3.1.1b
+- Hotfix: Fixed CivitAI link refuses to be downloaded properly. Seems like CivitAI changes its API.
+- Fixed several bugs on Windows, especially SDless
+
+#### Release v3.1.1a
+- Hotfix: Fixed CivitAI 'model type chooser' bug and fixed `@extract` bug on colab
+
+#### Release v3.1.1
+- Added some fix in case CivitAI website is down
+- Added message when user pressed "Download All!" but the textbox is empty
+- Fixed bug where Lycoris folder always shows on downloaded files the first time user download something
+
+#### Release v3.1.0a
+- Hotfix: Indented block on line 1497 fix
+
+### Release v3.1.0
+- New hashtag: `#altmodel`, when you use `--ckptdir` argument on `launch.py` line, this hashtag will points to that directory. Otherwise, it'll point to the same directory as `#model`
+- New hashtag: `#lycoris`, change current save directory to _/content/stable-diffusion-webui/extensions/sd-webui-additional-networks/models/lora/lycoris_
(Side note: _Lycoris/Locon/Loha_ will works just fine if you use `#addnetlora` instead, as long as you have both [addnet extension](https://github.com/kohya-ss/sd-webui-additional-networks) and [locon extension](https://github.com/KohakuBlueleaf/a1111-sd-webui-locon) installed)
+- New hashtag: `#upscaler`, change current save directory to _/content/stable-diffusion-webui/models/ESRGAN_ (This was added few commits ago, but i forgot to write it on the release notes)
+
+Fixes:
+- Fixed bug when installing wget/aria2 on Windows
+- Fixed sdless scripts so that it also installs `tqdm`
+- Fixed bug where custom paths doesn't put CivitAi download (Model Path method) when custom hashtag is used
+- Ongoing downloads will correctly stops when Cancel button is pressed on Windows
+- CivitAi (Model Path method) now will not download training dataset by accident
+
+#### Release v3.0.2
+- Hotfix: removed a comment that messed up the non queue mode. Now the extension works again without `--gradio-queue`.
+
+#### Release v3.0.1
+- Hotfix: using `urllib.request` instead of `curl -sI` to get the model name on CivitAI direct link method, since it's more reliable (and the curl method always fails somehow). The `requests` method is returned as a fallback.
+
+### Release v3.0.0
+- Added `@extract` syntax
+- (Almost) Full Windows support
+- Auto-download config file if available when downloading from CivitAI (SD 2.0+)
+- Auto-renaming for downloading ckpt/safetensors and pruned model from CivitAI using direct link method
+- CivitAI direct link now use `curl` to get the filename, and use the chosen download method (from the four) to download. Huge download speed boost. `requests` is no longer needed.
+- Supports download from Anonfiles, Dropbox, Google Drive, Mediafire, Pixeldrain
+- Supports download from Github (raw and release files)
+- Supports for custom hashtags with `@new` syntax
+- Supports for SDless mode (read more [here](https://github.com/etherealxx/batchlinks-webui#sdless-mode))
+- UI overhaul:
+ - Now there's a table that shows where does the hashtags points into
+ - Option to stretch the UI, if your monitor is small, or using colab on mobile
+ - Option to hide help text
+ - Option to choose preferred CivitAI models. This will works if you download the model via model page link (https://civitai.com/models/)
+ - Upload txt now use a little button instead of covering half of the screen
+
+Fixes:
+- CivitAI `model page link` no longer randomly download the first model on the json list.
+- Most of Windows bugs
+- Renaming problem when using CivitAI model page link method
+- Warning message when CivitAI download isn't possible (server down)
+
+### Older Release
+
+ 👈v2.0.0 - v2.1.1
+
+ Release v2.1.1
+ Partial Windows support is back
+ Changes:
+
+ wget
disabled on windows currently, until it fixed
+
+ Fixes:
+
+ gdown
& curl
bug fixed
+ utf-8
as default encoding for queue checker (fix bug in Windows)
+
+ Release v2.1.0
+ Features:
+
+ - Supports renaming downloaded file with
>
(for example: https://files.catbox.moe/uarze8.safetensors > neurosama.safetensors
)
+ - Supports extension usage without
--gradio-queue
(ported from onedotsix)
+ - Supports running shell command from the UI with
!
(for example: type !pip freeze
, then hit the Download all!
button and see the colab console)
+ - Progress bar for
--gradio-queue
+
+ Changes:
+
+ aria2
as the only download method when using without --gradio-queue
+ - Download session will be cut every 80 seconds on when using without
--gradio-queue
(just like onedotsix)
+ - Debug stopwatch (decorator) won't run automatically when
globaldebug = True
, must be uncommented manually (it disrupt the progress bar)
+ - Dropped support for webui based on Gradio 3.9 (update your installation, or use onedotsix instead)
+
- UI tweak (Smaller font size)
+
+ Release v2.0.0
+ Features:
+
+ aria2
as download method.
+ - Cancel button for cancelling download process (
--gradio-queue
required)
+ - Detection if a CivitAI links no longer exist
+
- New hashtags:
#textualinversion
, #ti
, #aestheticembedding
, #aestheticembed
, #controlnet
, and #cnet
+ - Toggle logging on/off
+
shlex.quote
to properly quote links (Thanks @rti7743!)
+ - Supports cloning webui extensions
+
- Supports download from catbox.moe
+
- Supports download from CivitAI model links (Thanks @rti7743!)
+
- Supports download from Github (repository and raw files)
+
- Supports for aesthetic gradients, controlnet model, and extensions path.
+
- UI font scaled down
+
- Uses
subprocess.Popen
instead of os.system
+
_
+ - Debug snapshot
+ When globaldebug = True
, the moment this extension launch, it saves the current state of the webui on various location (into snapshot.txt
), and when you type #debugresetdownloads
on the textbox, it will compare the current state and the last saved state, and removes every new file/folder. This will be useful for debugging and testing.
+ - Debug every download method
+ When globaldebug = True
and you type #debugevery method
on the textbox, every link that has 4 different method of download (Huggingface etc.) will be downloaded with every method, regardless of the radio button choice. The result is 4 file being downloaded.
+ - Debug stopwatch
+ When globaldebug = True
, it will give an output for how long a single download session lasts
+
+
+
\ No newline at end of file
diff --git a/Jac12/extensions/batchlinks-webui-main/scripts/a_gradiocheck.py b/Jac12/extensions/batchlinks-webui-main/scripts/a_gradiocheck.py
new file mode 100644
index 0000000000000000000000000000000000000000..3250a3156bb4b1db2c1cd937e6c5c7519788ee3c
--- /dev/null
+++ b/Jac12/extensions/batchlinks-webui-main/scripts/a_gradiocheck.py
@@ -0,0 +1,36 @@
+from modules.shared import cmd_opts
+import os, inspect, re #, sys, shlex
+
+script_dir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
+batchlinks_dir = os.path.join(script_dir, "batchlinks-downloader.py")
+
+# remove the progress bar if queue off
+with open(batchlinks_dir, 'r', encoding='utf-8') as f:
+ contents = f.read()
+
+gradio_queue_on = False
+
+try:
+ if cmd_opts.gradio_queue: #automatic1111
+ gradio_queue_on = True
+except AttributeError:
+ if not cmd_opts.disable_queue: #vladmandic
+ gradio_queue_on = True
+
+if gradio_queue_on:
+ #os.system(f"sed -i 's/def run(command, choosedowner):/def run(command, choosedowner, progress=gr.Progress()):/g' {batchlinks_dir}")
+ # os.system(f"sed -i '/^#progress/s/^#//' {batchlinks_dir}")
+ new_contents = re.sub(r'^(\s*)#progress\(', r'\1progress(', contents, flags=re.MULTILINE)
+ contents = re.sub(r'civitvae\):', 'civitvae, progress=gr.Progress()):', new_contents, flags=re.MULTILINE)
+
+ with open(batchlinks_dir, 'w', encoding='utf-8') as f:
+ f.write(contents)
+
+else:
+ # os.system(f"sed -i 's/def run(command, choosedowner, progress=gr.Progress()):/def run(command, choosedowner):/g' {batchlinks_dir}")
+ # os.system(f"sed -i '/^progress(/ s/^/#/' {batchlinks_dir}")
+ new_contents = re.sub(r'^(\s*)progress\(', r'\1#progress(', contents, flags=re.MULTILINE)
+ contents = re.sub(r'civitvae,\s*progress=gr\.Progress\(\)\):$', 'civitvae):', new_contents, flags=re.MULTILINE)
+
+ with open(batchlinks_dir, 'w', encoding='utf-8') as f:
+ f.write(contents)
\ No newline at end of file
diff --git a/Jac12/extensions/batchlinks-webui-main/scripts/batchlinks-downloader.py b/Jac12/extensions/batchlinks-webui-main/scripts/batchlinks-downloader.py
new file mode 100644
index 0000000000000000000000000000000000000000..c278cedb87caf56bb5802a6f515d2f0baa1e3a69
--- /dev/null
+++ b/Jac12/extensions/batchlinks-webui-main/scripts/batchlinks-downloader.py
@@ -0,0 +1,2289 @@
+#github.com/etherealxx
+import os
+import time
+import gradio as gr
+import urllib.request, subprocess, contextlib #these handle mega.nz
+import http.client
+import requests #this handle civit
+import re
+from tqdm import tqdm
+#from IPython.display import display, clear_output
+import pathlib
+import inspect
+import platform
+import shlex
+import signal
+import sys
+sdless = False
+try:
+ from modules import script_callbacks #,scripts
+ from modules.paths import models_path, script_path #, data_path
+ from modules.shared import cmd_opts #check for gradio queue
+except ImportError: #sdless
+ if platform.system() == "Windows":
+ userprofile = os.environ['USERPROFILE']
+ downloadpath = os.path.join(userprofile, "Downloads")
+ script_path = os.path.join(downloadpath, "stable-diffusion-webui")
+ elif platform.system() == "Darwin":
+ userhome = os.environ['HOME']
+ downloadpath = os.path.join(userhome, "Downloads")
+ script_path = os.path.join(downloadpath, "stable-diffusion-webui")
+ else:
+ script_path = '/content/stable-diffusion-webui'
+ models_path = os.path.join(script_path, 'models')
+ gradio_queue = True
+ ckpt_dir = None
+ import sys
+ import types
+ module = types.ModuleType('cmd_opts')
+ module.gradio_queue = gradio_queue
+ module.ckpt_dir = ckpt_dir
+ sys.modules['cmd_opts'] = module
+ import cmd_opts
+ sdless = True
+
+script_dir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
+extension_dir = os.path.abspath(os.path.join(script_dir, "../"))
+#Version checking{
+version_dir = os.path.join(extension_dir, "version.txt")
+with open(version_dir, 'r', encoding='utf-8') as file:
+ curverall = file.readlines()
+currentversion = curverall[0].strip()
+
+try:
+ versionurl = "https://raw.githubusercontent.com/etherealxx/batchlinks-webui/main/version.txt"
+ versionresp = requests.get(versionurl)
+ version_lines = versionresp.text.splitlines()
+ latestversion = version_lines[0].strip()
+except requests.exceptions.RequestException:
+ latestversion = '??'
+
+if latestversion != '??':
+ if currentversion == latestversion:
+ latestversiontext = ""
+ else:
+ latestversiontext = f"[Latest version: {latestversion}]"
+else:
+ latestversiontext = ""
+
+currentverforlink = latestversion.replace('.', '')
+#}
+
+vladmandic = False
+try:
+ global gradiostate
+ if cmd_opts.gradio_queue: #automatic1111
+ gradiostate = True
+ else:
+ gradiostate = False
+except AttributeError:
+ try:
+ if not cmd_opts.disable_queue: #vladmandic
+ gradiostate = True
+ else:
+ gradiostate = False
+ vladmandic = True
+ except AttributeError:
+ gradiostate = False #at this point just use onedotsix
+ pass
+
+typechecker = [
+ "embedding", "embeddings", "embed", "embeds", "textualinversion", "ti",
+ "model", "models", "checkpoint", "checkpoints",
+ "vae", "vaes",
+ "lora", "loras",
+ "hypernetwork", "hypernetworks", "hypernet", "hypernets", "hynet", "hynets",
+ "addnetlora", "loraaddnet", "additionalnetworks", "addnet",
+ "aestheticembedding", "aestheticembed",
+ "controlnet", "cnet",
+ "extension", "extensions", "ext", #obsolete
+ "upscaler", "upscale",
+ "altmodel", "altmodels",
+ "lycoris", "locon", "loha"
+ ]
+
+typemain = [
+ "model", "altmodel", "vae",
+ "embed", "hynet", "lora",
+ "addnetlora", "aestheticembed", "cnet",
+ "ext", "upscaler", "lycoris"
+]
+countofdefaulthashtags = len(typemain)
+
+supportedlinks = [
+ "https://mega.nz",
+ "https://huggingface.co",
+ "https://civitai.com/api/download/models",
+ "https://civitai.com/models/",
+ "https://cdn.discordapp.com/attachments",
+ "https://github.com",
+ "https://raw.githubusercontent.com",
+ "https://files.catbox.moe",
+ "https://drive.google.com",
+ "https://pixeldrain.com",
+ "https://www.mediafire.com/file",
+ "https://anonfiles.com",
+ "https://www.dropbox.com/s"
+]
+
+modelpath = os.path.join(script_path, "models/Stable-diffusion")
+embedpath = os.path.join(script_path, "embeddings")
+vaepath = os.path.join(script_path, "models/VAE")
+lorapath = os.path.join(script_path, "models/Lora")
+addnetlorapath = os.path.join(script_path, "extensions/sd-webui-additional-networks/models/lora")
+hynetpath = os.path.join(script_path, "models/hypernetworks")
+aestheticembedpath = os.path.join(script_path, "extensions/stable-diffusion-webui-aesthetic-gradients/aesthetic_embeddings")
+cnetpath = os.path.join(script_path, "extensions/sd-webui-controlnet/models")
+extpath = os.path.join(script_path, "extensions") #obsolete
+upscalerpath = os.path.join(script_path, "models/ESRGAN")
+lycorispath = os.path.join(addnetlorapath, "lycoris")
+
+if vladmandic:
+ cnetpath = os.path.join(script_path, "models/ControlNet")
+ lycorispath = os.path.join(script_path, "models/LyCORIS")
+
+if cmd_opts.ckpt_dir:
+ altmodelpath = cmd_opts.ckpt_dir
+ currentfolder = altmodelpath
+else:
+ altmodelpath = modelpath
+ currentfolder = modelpath
+
+if platform.system() == "Windows":
+ for x in typemain:
+ # exec(f"{x}path = os.path.normpath({x}path)")
+ exec(f"{x}path = {x}path.replace('/', '\\\\')")
+ #exec(f"print({x}path)")
+if os.path.exists(addnetlorapath) and not os.path.exists(lycorispath):
+ os.makedirs(lycorispath, exist_ok=True)
+
+newlines = ['\n', '\r\n', '\r']
+currentlink = ''
+finalwrite = []
+currentcondition = ''
+currentsuboutput = ''
+processid = ''
+logging = False
+#currentiterfolder = ''
+prockilled = False
+currentfoldertrack = []
+everyprocessid = []
+remaininglinks = []
+gdownupgraded = False
+mediafireinstalled = False
+prevciviterror = False
+# addedcustompath = []
+# ariamode = False
+
+globaldebug = False #set this to true to activate every debug features
+if len(sys.argv) > 1:
+ if sys.argv[1] == '--debug':
+ globaldebug = True
+
+process = ''
+
+def stopwatch(func): #unused
+ """
+ A function that acts as a stopwatch for another function.
+
+ Args:
+ func (function): The function to be timed.
+
+ Returns:
+ The return value of the timed function.
+ """
+ def wrapper(*args, **kwargs):
+ if not globaldebug:
+ return func(*args, **kwargs)
+ start_time = time.time()
+ result = func(*args, **kwargs)
+ end_time = time.time()
+ elapsed_time = end_time - start_time
+ minutes = int(elapsed_time // 60)
+ seconds = elapsed_time % 60
+ print(f"Time taken by {func.__name__}: {minutes:.0f}m {seconds:.2f}s")
+ return result
+ return wrapper
+
+#debuggingpurpose{
+ #Hello debuggers! This will track every files when the extension is launched, and
+ #you can remove every downloaded files after with hashtag '@debugresetdownloads', for debugging purposes on colab
+ #(Note: You need to fill the textbox with only a single line of @debugresetdownloads and nothing more)
+ #There's also another feature, '#debugeverymethod', which will download a single link with all four possible methods available.
+import shutil
+snapshot = []
+paths_to_scan = []
+
+# take a snapshot of the directories
+def take_snapshot():
+ snapshotdir = os.path.join(script_path, 'snapshot.txt')
+ global snapshot
+ global paths_to_scan
+ paths_to_scan = []
+ for x in typemain:
+ exec(f"paths_to_scan.append({x}path)")
+ if os.path.exists(snapshotdir):
+ with open(snapshotdir, 'r') as f:
+ snapshot = [line.strip() for line in f.readlines()]
+ print("Batchlinks extension: snapshot already exist.")
+ return
+ else:
+ snapshot = []
+ for path in paths_to_scan:
+ if os.path.exists(path):
+ pathtemp = os.listdir(path)
+ for file in pathtemp:
+ pathoffile = os.path.join(path, file)
+ snapshot.append(pathoffile)
+ with open(snapshotdir, 'w') as f:
+ for item in snapshot:
+ f.write(f"{item}\n")
+ print("Batchlinks extension: snapshot taken.")
+
+# rewind everything to a fresh state
+def global_rewind():
+ global paths_to_scan
+ global path
+ global currentsuboutput
+ removedall, removed_files, removed_dirs, new_snapshot = [], [], [], []
+ print('[1;32mDebug rewind initiated...')
+ print('[0m')
+ for path in paths_to_scan:
+ if os.path.exists(path):
+ pathtemp = os.listdir(path)
+ for file in pathtemp:
+ pathoffile = os.path.join(path, file)
+ new_snapshot.append(pathoffile)
+ toremoves = [x for x in new_snapshot if x not in snapshot]
+ for fileordir in toremoves:
+ if os.path.exists(fileordir):
+ if os.path.isdir(fileordir):
+ try:
+ shutil.rmtree(fileordir)
+ removed_dirs.append(fileordir)
+ except PermissionError as e:
+ print("Error: " + str(e))
+ else:
+ os.remove(fileordir)
+ removed_files.append(fileordir)
+ if removed_files or removed_dirs:
+ print("Removed files:")
+ removedall.append("Removed files:")
+ for file in removed_files:
+ print(file)
+ removedall.append(file)
+ print("Removed directories:")
+ removedall.append("Removed directories:")
+ for dir in removed_dirs:
+ print(dir)
+ removedall.append(dir)
+ print('[1;32mrewind completed')
+ print('[0m')
+ return removedall
+
+# Take a snapshot of the directories
+if globaldebug == True:
+ take_snapshot()
+# }
+
+def printdebug(toprint):
+ if globaldebug == True:
+ print(toprint)
+
+def printvardebug(toprint):
+ if globaldebug == True:
+ import inspect
+ caller = inspect.currentframe().f_back
+ try:
+ name = [k for k, v in caller.f_locals.items() if v is toprint][0]
+ except IndexError:
+ name = "idk"
+ if not isinstance(toprint, str):
+ toprint = str(toprint)
+ print(f"debug {name}: {toprint}")
+
+def runwithsubprocess(rawcommand, folder=None, justrun=False, additionalcontext=''): #@note runwithsubprocess
+
+ commandtorun = shlex.split(rawcommand) #construct_command(rawcommand)
+ printdebug(f"raw command: {rawcommand}")
+ printdebug(f"merged command: {commandtorun}")
+ global prockilled
+ global everyprocessid
+ # if gradiostate == False and not rawcommand.startswith("aria"):
+ # subprocess.run(commandtorun, stderr=subprocess.STDOUT, universal_newlines=True)
+ # else:
+ if folder != None:
+ printdebug("debug folderforsavestate: " + str(folder))
+ savestate_folder(folder)
+ printdebug("debug currentfoldertrack: " + str(currentfoldertrack))
+
+ global process
+ if justrun:
+ process = subprocess.Popen(rawcommand, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, universal_newlines=True, shell=True)
+ else:
+ process = subprocess.Popen(commandtorun, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, universal_newlines=True)
+ global processid
+ processid = process.pid
+ everyprocessid.append(processid)
+ printdebug("debug processid: " + str(processid))
+
+ ariacomplete = False
+ global currentsuboutput
+ while True:
+ # Read the output from the process
+ nextline = process.stdout.readline()
+ if nextline == '' and process.poll() is not None:
+ break
+ # Check if the line contains progress information
+ elif additionalcontext == 'aria2':
+ if 'Download Results' in nextline:
+ ariacomplete = True
+ print('\n')
+ print(nextline, end='')
+ currentsuboutput = nextline
+ else:
+ if not ariacomplete:
+ match = re.search(r'\[[^\]]+\]', nextline)
+ if match:
+ stripnext = match.group().strip()
+ print("\r", end="")
+ print(f"\r{stripnext}", end='')
+ currentsuboutput = stripnext
+ else:
+ print(nextline, end='')
+ currentsuboutput = nextline
+ elif additionalcontext == '7z':
+ sevenzmessage = [
+ "Extracting", "Everything", "ERROR"
+ ]
+ if nextline.strip().startswith(tuple(sevenzmessage)):
+ print(nextline, end=' ')
+ currentsuboutput = nextline
+ else:
+ stripnext = nextline.strip()
+ print("\r", end="")
+ print(f"\r{stripnext}", end='')
+ currentsuboutput = stripnext
+ else:
+ if justrun:
+ print(nextline, end='')
+ else:
+ if "%" in nextline.strip() or rawcommand.startswith("curl"):
+ stripnext = nextline.strip()
+ print("\r", end="")
+ print(f"\r{stripnext}", end='')
+ else:
+ print(nextline, end='')
+ if additionalcontext == 'mega':
+ process.kill()
+ if additionalcontext == 'mega':
+ if nextline.strip().startswith("Download finished:"):
+ _ = subprocess.getoutput("taskkill /f /t /im MEGAcmdServer.exe")
+ printdebug("MEGA server killed")
+ currentsuboutput = nextline
+
+
+ process.wait()
+ currentsuboutput = ''
+ processid = ''
+ if prockilled == True:
+ printdebug("before rewind folder")
+ printvardebug(folder)
+ rewind_folder(folder)
+ print('[1;31mOperation Cancelled')
+ print('[0m')
+ global currentcondition
+ currentcondition = 'Operation Cancelled'
+ return
+
+#these code below handle mega.nz
+def unbuffered(proc, stream='stdout'):
+ stream = getattr(proc, stream)
+ with contextlib.closing(stream):
+ while prockilled == False:
+ out = []
+ last = stream.read(1)
+ # Don't loop forever
+ if last == '' and proc.poll() is not None:
+ break
+ while last not in newlines:
+ # Don't loop forever
+ if last == '' and proc.poll() is not None:
+ break
+ out.append(last)
+ last = stream.read(1)
+ out = ''.join(out)
+ yield out
+
+def transfare(todownload, folder, torename=''):
+ #import codecs
+ #decoder = codecs.getincrementaldecoder("UTF-8")()
+ todownload_s = shlex.quote(todownload)
+ folder_s = shlex.quote(folder)
+ if platform.system() == "Windows":
+ savestate_folder(folder)
+ localappdata = os.environ['LOCALAPPDATA']
+ megagetloc = os.path.join(localappdata, "MEGAcmd", "mega-get.bat")
+ global process
+ process = runwithsubprocess(f"{shlex.quote(megagetloc)} {todownload_s} {folder_s}", folder, False, 'mega')
+ else:
+ savestate_folder(folder_s)
+ cmd = ["mega-get", todownload_s, folder_s]
+ proc = subprocess.Popen(
+ cmd,
+ stdout=subprocess.PIPE,
+ stderr=subprocess.STDOUT,
+ universal_newlines=True,
+ )
+ global processid
+ global everyprocessid
+ processid = proc.pid
+ everyprocessid.append(processid)
+
+ global currentsuboutput
+ for line in unbuffered(proc):
+ if prockilled == False:
+ if not line.startswith("Download"):
+ currentsuboutput = line
+ print(f"\r{line}", end="")
+ else:
+ print(f"\n{line}")
+ _ = subprocess.getoutput("pkill -f \"mega-cmd-server\"")
+ printdebug("MEGA server killed")
+
+ else:
+ currentsuboutput = ''
+ print('[1;31mOperation Cancelled')
+ print('[0m')
+ global currentcondition
+ currentcondition = 'Operation Cancelled'
+ return
+ currentsuboutput = ''
+ if torename:
+ listfilenew = os.listdir(folder)
+ newerfoldertrack = []
+ for file in listfilenew:
+ pathoffile = os.path.join(folder, file)
+ newerfoldertrack.append(pathoffile)
+ checkrename = [x for x in newerfoldertrack if x not in currentfoldertrack]
+ if checkrename:
+ # renamedfile = os.path.basename(checkrename[0])
+ # pathtorename = os.path.join(folder, renamedfile)
+ os.rename(checkrename[0], os.path.join(folder, torename))
+
+
+def installmega():
+ HOME = os.path.expanduser("~")
+ ocr_file = pathlib.Path(f"{HOME}/.ipython/ocr.py")
+ if not ocr_file.exists():
+ hCode = "https://raw.githubusercontent.com/biplobsd/" \
+ "OneClickRun/master/res/ocr.py"
+ urllib.request.urlretrieve(hCode, str(ocr_file))
+
+ from importlib.util import module_from_spec, spec_from_file_location
+ ocr_spec = spec_from_file_location("ocr", str(ocr_file))
+ ocr = module_from_spec(ocr_spec)
+ ocr_spec.loader.exec_module(ocr)
+
+ if not os.path.exists("/usr/bin/mega-cmd"):
+ #ocr.loadingAn()
+ print('[1;32mInstalling MEGA ...')
+ print('[0m')
+ ocr.runSh('sudo apt-get -y update')
+ ocr.runSh('sudo apt-get -y install libmms0 libc-ares2 libc6 libcrypto++6 libgcc1 libmediainfo0v5 libpcre3 libpcrecpp0v5 libssl1.1 libstdc++6 libzen0v5 zlib1g apt-transport-https')
+ ocr.runSh('sudo curl -sL -o /var/cache/apt/archives/MEGAcmd.deb https://mega.nz/linux/MEGAsync/Debian_9.0/amd64/megacmd-Debian_9.0_amd64.deb', output=True)
+ ocr.runSh('sudo dpkg -i /var/cache/apt/archives/MEGAcmd.deb', output=True)
+ print('[1;32mMEGA is installed.')
+ print('[0m')
+
+def installmegawin():
+ userprofile = os.environ['USERPROFILE']
+ localappdata = os.environ['LOCALAPPDATA']
+ megagetloc = os.path.join(localappdata, "MEGAcmd", "mega-get.bat")
+ megacmdloc = os.path.join(userprofile, "Downloads", "MEGAcmdSetup64.exe")
+ if not os.path.exists(megagetloc):
+ print('[1;32mInstalling MEGA ...')
+ print('[0m')
+ runwithsubprocess(f"curl -o {shlex.quote(megacmdloc)} https://mega.nz/MEGAcmdSetup64.exe")
+ time.sleep(1)
+ runwithsubprocess(f"{shlex.quote(megacmdloc)} /S")
+ time.sleep(4)
+ print('[1;32mMEGA is installed.')
+ print('[0m')
+ #clear_output()
+#these code above handle mega.nz
+
+def civitdown(url, folder, torename=''):
+ filename = url.split('?')[0].rsplit('/', 1)[-1] + ".bdgh"
+ pathtodown = os.path.join(folder, filename)
+ max_retries = 5
+ retry_delay = 10
+ # url_s = quote(url)
+
+ while prockilled == False:
+
+ downloaded_size = 0
+ headers = {}
+
+ progress = tqdm(total=1000000000, unit="B", unit_scale=True, desc=f"Downloading {filename}. (will be renamed correctly after downloading)", initial=downloaded_size, leave=False)
+ global currentsuboutput
+ global currentcondition
+ with open(pathtodown, "ab") as f:
+ while prockilled == False:
+ try:
+ response = requests.get(url, headers=headers, stream=True)
+ total_size = int(response.headers.get("Content-Length", 0))
+ # if total_size == 0:
+ # total_size = downloaded_size
+ # progress.total = total_size
+
+
+ for chunk in response.iter_content(chunk_size=1024):
+ if chunk and prockilled == False:
+ f.write(chunk)
+ progress.update(len(chunk))
+ currentsuboutput = str(progress)
+ else:
+ break
+
+ downloaded_size = os.path.getsize(pathtodown)
+ currentsuboutput = ''
+ break
+ except ConnectionError as e:
+ max_retries -= 1
+
+ if max_retries == 0:
+ raise e
+
+ time.sleep(retry_delay)
+
+ progress.close()
+ if prockilled == True:
+ if os.path.exists(pathtodown):
+ os.remove(pathtodown)
+ print('[1;31mOperation Cancelled')
+ print('[0m')
+ currentcondition = 'Operation Cancelled'
+ currentsuboutput = ''
+ return "Operation Cancelled"
+
+ if torename:
+ actualfilename = torename
+ else:
+ try:
+ actualfilename = response.headers['Content-Disposition'].split("filename=")[1].strip('"')
+ except KeyError:
+ print('[1;31mLink Error')
+ print('[0m')
+ break
+ #%cd {folder}
+ actualpath = os.path.join(folder, actualfilename)
+ os.rename(pathtodown, actualpath)
+ downloaded_size = os.path.getsize(actualpath)
+ # Check if the download was successful
+ if downloaded_size >= total_size:
+ print(f"{actualfilename} successfully downloaded.")
+ break
+ else:
+ print(f"Error: File download failed. Retrying...")
+
+def getcivitname(link, frommodeltypechooser=False): #@note getcivitname
+ # searcher = "findstr" if platform.system() == "Windows" else "grep"
+ printdebug("getcivitname:")
+ printvardebug(link)
+ global currentcondition
+ tempcondition = currentcondition
+ currentcondition = "Connecting to CivitAI..."
+ try:
+ req = urllib.request.Request(link, headers={'User-Agent': 'Mozilla/5.0'})
+ response = urllib.request.urlopen(req, timeout=7)
+ contentdis = response.geturl()
+ # contentdis = [line for line in subprocess.getoutput(f"curl -sI {link} | {searcher} -i content-disposition").splitlines() if line.startswith('location')][0]
+ except Exception as e:
+ errortype = str(type(e))
+ printdebug("Error: " + errortype)
+ if 'TimeoutError' in errortype:
+ print("Unable to connect to CivitAI in 7 seconds. Skipping the link...")
+ currentcondition = tempcondition
+ return 'batchlinksskip'
+ else:
+ if frommodeltypechooser:
+ currentcondition = tempcondition
+ return ''
+ else:
+ print("Cannot get the filename. Download will continue with the old slow method.\nReason:" + str(e))
+ currentcondition = tempcondition
+ return 'batchlinksold'
+ if contentdis == "https://civitai.com/":
+ print('[1;31mCivitAI website is currently down ツ')
+ print('[0m')
+ currentcondition = tempcondition
+ return 'batchlinksskip'
+ cuttedcontent = contentdis.find('response-content-disposition=attachment%3B%20filename%3D%22') + 59
+ # filename = str(contentdis[cuttedcontent:]).replace('%22&x-id=GetObject', '') #obsolete since 30-03-2023
+ filename = str(contentdis[cuttedcontent:]).partition('%22&')[0]
+ # filename = contentdis.split('filename=')[-1].split('%22')[1] #this also works i guess
+ filename = civitmodeltypename(filename, link)
+ currentcondition = tempcondition
+ return filename
+
+def getcivitname2(link):
+ searcher = "findstr" if platform.system() == "Windows" else "grep"
+ try:
+ contentdis = [line for line in subprocess.getoutput(f"curl -sI {link} | {searcher} -i content-disposition").splitlines() if line.startswith('location')][0]
+ cuttedcontent = contentdis.find('response-content-disposition=attachment%3B%20filename%3D%22') + 59
+ filename = str(contentdis[cuttedcontent:]).replace('%22&x-id=GetObject', '')
+ if filename:
+ return [0, link, filename]
+ except:
+ return []
+
+def civitmodeltypename(name, filelink):
+ nameonly, extension = os.path.splitext(name)
+ if 'type=Pruned' in filelink:
+ nameonly += "_pruned"
+
+ if 'format=Safetensor' in filelink:
+ extension = '.safetensors'
+ elif 'format=PickleTensor' in filelink:
+ extension = '.ckpt'
+
+ nameoffile = nameonly + extension
+ return nameoffile
+
+def checkcivitconfig(link): #check if the current civit link has a config file (v2.0+) @note checkcivitconfig
+ def getrequest(link2):
+ response = requests.get(link2)
+ return response.status_code
+
+ params = ['?type=Config','?type=Config&format=Other']
+
+ for param in params:
+ response = getrequest(link + param)
+ if response == 200:
+ #print('The link exists')
+ return link + param
+ return ''
+
+def civitmodeltypechooser(modeljson, prunedmodel, torchortensor, linkandnames):
+
+# prunedorfull = ['?type=Model', '?type=Pruned%20Model']
+# if prunedmodel == 'True':
+ prunedorfull = ['&fp=fp32', '&fp=fp16']
+ if prunedmodel == 'fp16':
+ prunedorfull.reverse()
+ pickleorsafe = ['&format=SafeTensor', '&format=PickleTensor']
+ if torchortensor=='ckpt':
+ pickleorsafe.reverse()
+
+ defaultlinkurl = [link.get('downloadUrl') for link in modeljson['modelVersions'][0]['files'] if not '?type=' in link.get('downloadUrl')][0]
+
+ indexlinkname = list()
+ checklater = ''
+ for index, (link, name) in enumerate(linkandnames.items()):
+ if prunedorfull[0] in link:
+ if pickleorsafe[0] in link:
+ indexlinkname.extend([index, link, name])
+ break
+ else:
+ checklater = link
+ continue
+ else:
+ continue
+
+ if checklater and not indexlinkname:
+ for index, (link, name) in enumerate(linkandnames.items()):
+ if checklater == link:
+ indexlinkname.extend([index, link, name])
+ checklater = ''
+ break
+
+ if not indexlinkname:
+ indexlinkname = getcivitname(defaultlinkurl+prunedorfull[0]+pickleorsafe[0], True) #@note indexlinkname
+ if indexlinkname == "batchlinksskip" or not indexlinkname:
+ indexlinkname = list()
+
+ if not indexlinkname:
+ for index, (link, name) in enumerate(linkandnames.items()):
+ if defaultlinkurl == link:
+ indexlinkname.extend([index, link, name])
+ break
+
+ return indexlinkname
+
+#thank you @rti7743 for this part {
+def civitdown2_get_json(url):
+ import re
+ m = re.search(r'https://civitai.com/models/(\d+)', url)
+ model_id = m.group(1)
+
+ api_url = "https://civitai.com/api/v1/models/" + model_id
+
+ import requests
+ txt = requests.get(api_url).text
+
+ import json
+ try:
+ return json.loads(txt)
+ except json.decoder.JSONDecodeError:
+ return 'error'
+
+def civitdown2_get_save_directory(model_type, default_folder):
+ printdebug("model_type: " + model_type)
+ customtypemains = list(typemain[countofdefaulthashtags:])
+ printdebug("customtypemains: " + str(customtypemains))
+ for type in customtypemains:
+ xpath = eval(type + "path")
+ if default_folder == xpath:
+ printdebug("customtype returned")
+ return default_folder
+ if model_type == "Checkpoint":
+ if cmd_opts.ckpt_dir and default_folder == altmodelpath:
+ return altmodelpath
+ else:
+ return modelpath
+ elif model_type == "Hypernetwork":
+ return hynetpath
+ elif model_type == "TextualInversion":
+ return embedpath
+ elif model_type == "AestheticGradient":
+ return aestheticembedpath
+ elif model_type == "VAE":
+ return vaepath
+ elif model_type == "LORA":
+ if default_folder == addnetlorapath:
+ return addnetlorapath
+ else:
+ return lorapath
+ elif model_type == "LoCon":
+ return lycorispath
+ else:
+ printdebug("defaultfolder returned")
+ return default_folder
+
+def civitdown2_convertimage(imagejpg_save_path, imagepng_save_path):
+ from PIL import Image
+ try:
+ img = Image.open(imagejpg_save_path)
+ img_resized = img.resize((img.width // 2, img.height // 2))
+ img_resized.save(imagepng_save_path)
+ if os.path.exists(imagejpg_save_path):
+ os.remove(imagejpg_save_path)
+ except Exception as e:
+ print("Civitai image convertion failed. Reason: " + str(e))
+ pass
+
+def civitdown2(url, folder, downloader, renamedfilename, isdebugevery, modeldefaulttype, isprunedmodel, isdownvae): #@note civitdown2
+ def civitlinkandnamer(model):
+ linkandname = dict()
+ for i, link in enumerate(model['modelVersions'][0]['files']):
+ name = link.get('name')
+ url = link.get('downloadUrl')
+ if name and url:
+ linkandname[url] = name
+ # print(i, url, name)
+ else:
+ pass
+ return linkandname
+
+ model = civitdown2_get_json(url)
+ if model == 'error':
+ print('[1;31mFailed retrieving the model data.')
+ print('[1;31mCivitAI website might going down currently.')
+ print('[0m')
+ return
+
+ if model == {'error': 'Model not found'}:
+ print('[1;31mModel ' + url + ' is not available anymore')
+ print('[0m')
+ return
+
+ save_directory = civitdown2_get_save_directory(model['type'], folder)
+ if not os.path.exists(save_directory):
+ os.makedirs(save_directory, exist_ok=True)
+ try:
+ parameter = url.split("?")[-1] + "?"
+ except:
+ parameter = ''
+
+ civitlinkandnames = civitlinkandnamer(model)
+
+ if model['type'] == "Checkpoint":
+ data_index, data_url, data_filename = civitmodeltypechooser(model, isprunedmodel, modeldefaulttype, civitlinkandnames) #@note
+ data_filename = civitmodeltypename(data_filename, data_url)
+ image_filename = model['modelVersions'][0]['files'][0]['name']
+ else:
+ data_url = model['modelVersions'][0]['files'][0]['downloadUrl']
+ data_filename = model['modelVersions'][0]['files'][0]['name']
+ if "?type=Training%20Data" in data_url:
+ data_url = data_url.partition("?")[0]
+ wannabename = getcivitname(data_url)
+ if wannabename:
+ if wannabename != 'batchlinksskip':
+ data_filename = wannabename
+ else:
+ return ''
+ image_filename = data_filename
+
+ if renamedfilename:
+ data_filename = renamedfilename
+ image_filename = data_filename
+
+ image_url = model['modelVersions'][0]['images'][0]['url']
+ printvardebug(data_url)
+ printvardebug(data_filename)
+ printvardebug(image_url)
+ if model['type'] == "TextualInversion":
+ image_filename_jpg = pathlib.PurePath(image_filename).stem + ".preview.jpg"
+ image_filename_png = pathlib.PurePath(image_filename).stem + ".preview.png"
+ else:
+ image_filename_jpg = pathlib.PurePath(image_filename).stem + ".jpg"
+ image_filename_png = pathlib.PurePath(image_filename).stem + ".png"
+
+ data_save_path = os.path.join(save_directory, data_filename)
+ imagejpg_save_path = os.path.join(save_directory, image_filename_jpg)
+ imagepng_save_path = os.path.join(save_directory, image_filename_png)
+
+ currentmode = 'civit'
+ if isdebugevery:
+ currentmode = 'civitdebugevery'
+
+ printdebug(f"debug download_url({data_url}, {data_save_path}, {downloader})")
+ if prockilled == False:
+ hfdown(data_url, data_save_path, downloader, currentmode)
+ printdebug("normal download done, now check for the config")
+ config_url = checkcivitconfig(data_url)
+ vae_url, vae_name = '',''
+ for link, name in civitlinkandnames.items():
+ if '?type=VAE' in link:
+ vae_url, vae_name = link, name
+ break
+ if model['type'] == "Checkpoint":
+ if prockilled == False and isdownvae and vae_url:
+ namefile = os.path.splitext(data_filename)[0]
+ vae_name = namefile + '.vae.pt'
+ data_save_path = os.path.join(os.path.dirname(data_save_path), vae_name)
+ hfdown(vae_url, data_save_path, downloader, currentmode)
+ if prockilled == False and config_url:
+ namefile = os.path.splitext(data_filename)[0]
+ config_name = namefile + '.yaml'
+ data_save_path = os.path.join(os.path.dirname(data_save_path), config_name)
+ hfdown(config_url, data_save_path, downloader, currentmode)
+
+ if prockilled == False:
+ hfdown(image_url, imagejpg_save_path, downloader, currentmode)
+ if os.path.exists(imagejpg_save_path):
+ civitdown2_convertimage(imagejpg_save_path, imagepng_save_path)
+ else:
+ print(imagejpg_save_path + " doesn't exist")
+ if prockilled == False:
+ print(f"{data_save_path} successfully downloaded.")
+
+ if isdebugevery:
+ additionalname = '-' + downloader
+
+ if model['type'] == "TextualInversion":
+ image_filename_jpg = pathlib.PurePath(data_filename).stem + additionalname + ".preview.jpg"
+ image_filename_png = pathlib.PurePath(data_filename).stem + additionalname + ".preview.png"
+ else:
+ image_filename_jpg = pathlib.PurePath(data_filename).stem + additionalname + ".jpg"
+ image_filename_png = pathlib.PurePath(data_filename).stem + additionalname + ".png"
+
+ imagejpg_save_path = os.path.join(save_directory, image_filename_jpg)
+ imagepng_save_path = os.path.join(save_directory, image_filename_png)
+
+#}
+def mediadrivedown(todownload, folder, mode, torename=''): #@note mediadrivedown
+ todownload_s = shlex.quote(todownload)
+ if platform.system() == "Windows":
+ folder_s = folder
+ else:
+ folder_s = shlex.quote(folder)
+ prevcurdir = os.getcwd()
+ os.chdir(folder)
+ savestate_folder(folder_s)
+
+ if mode=='gdrive':
+ runwithsubprocess(f"gdown --fuzzy {todownload_s}", folder_s)
+ elif mode=='mediafire':
+ runwithsubprocess(f"mediafire-dl {todownload_s}", folder_s)
+
+ os.chdir(prevcurdir)
+ if torename:
+ listfilenew = os.listdir(folder)
+ newerfoldertrack = []
+ for file in listfilenew:
+ pathoffile = os.path.join(folder, file)
+ newerfoldertrack.append(pathoffile)
+ checkrename = [x for x in newerfoldertrack if x not in currentfoldertrack]
+ if checkrename:
+ os.rename(checkrename[0], os.path.join(folder, torename))
+
+def hfdown(todownload, folder, downloader, mode='default', torename=''): #@note hfdown
+ global currentcondition
+ global prevciviterror
+ prevciviterror = False
+ # global ariamode
+ if mode=='civit' or mode=='civitdebugevery':
+ filename = pathlib.Path(folder).name
+ filename_s = shlex.quote(filename)
+ filepath = folder
+ filepath_s = shlex.quote(folder)
+ todownload_s = todownload
+ folder = os.path.dirname(filepath)
+ # folder_s = pathlib.Path(folder).parent.resolve()
+ folder_s = shlex.quote(folder)
+ folder_win = folder
+ else:
+ if mode=='pixeldrain' or mode=='dropbox':
+ filename = torename
+ else:
+ filename = todownload.rsplit('/', 1)[-1]
+ filename_s = shlex.quote(filename)
+ filepath = os.path.join(folder, filename)
+ filepath_s = shlex.quote(filepath)
+ todownload_s = shlex.quote(todownload)
+ folder_s = shlex.quote(folder)
+ folder_win = folder
+ ariafilename_s = filename_s
+ if torename:
+ ariafilename_s = shlex.quote(torename)
+
+ printvardebug(folder)
+ printvardebug(todownload)
+ printvardebug(filename)
+ printvardebug(filename_s)
+ printvardebug(filepath)
+ printvardebug(filepath_s)
+ printvardebug(todownload_s)
+ printvardebug(folder_s)
+ printvardebug(folder_win)
+ #savestate_folder(folder_s)
+
+ if platform.system() == "Windows": #@note windows downloader
+ localappdata = os.environ['LOCALAPPDATA']
+ batchlinksinstallpath = os.path.join(localappdata, "batchlinks")
+ printvardebug(batchlinksinstallpath)
+ wgetpath = os.path.join(batchlinksinstallpath, "wget-gnutls-x64.exe")
+
+ ariazippath = os.path.join(batchlinksinstallpath, "aria2-1.36.0-win-64bit-build2.7z")
+ ariapath = os.path.join(batchlinksinstallpath, "aria2-1.36.0-win-64bit-build2", "aria2c.exe")
+ os.makedirs(batchlinksinstallpath, exist_ok=True)
+ if os.path.exists(batchlinksinstallpath):
+ printdebug("batchlinksinstallpath created")
+ if downloader=='gdown':
+ global gdownupgraded
+ if gdownupgraded == False:
+ tempcondition = currentcondition
+ currentcondition = "Upgrading gdown..."
+ print('[1;32mUpgrading gdown ...')
+ print('[0m')
+ runwithsubprocess(f"pip3 install -q --upgrade --no-cache-dir gdown")
+ print('[1;32mgdown upgraded!')
+ print('[0m')
+ currentcondition = tempcondition
+ gdownupgraded = True
+ try:
+ runwithsubprocess(f"gdown {todownload_s} -O {filepath_s}", folder_win)
+ except FileNotFoundError:
+ import gdown
+ gdown.download(todownload, filepath, quiet=False)
+ elif downloader=='wget':
+ #os.system("python -m wget -o " + os.path.join(folder, filename) + " " + todownload)
+ # import wget
+ # wget.download(todownload, filepath)
+ # checkwget = subprocess.getoutput(wgetpath)
+ # if "is not recognized" in checkwget:
+ if not os.path.exists(wgetpath):
+ tempcondition = currentcondition
+ currentcondition = "Installing wget Windows..."
+ print('[1;32mInstalling wget Windows...')
+ print('[0m')
+ wgetwinlink = "https://github.com/webfolderio/wget-windows/releases/download/v1.21.3.june.19.2022/wget-gnutls-x64.exe"
+ print(wgetwinlink)
+ runwithsubprocess("curl -Lo " + shlex.quote(wgetpath) + " " + wgetwinlink, batchlinksinstallpath)
+ print('[1;32mwget Windows installed!')
+ print('[0m')
+ currentcondition = tempcondition
+ runwithsubprocess(f"{shlex.quote(wgetpath)} -O {filepath_s} {todownload_s} --progress=bar:force", folder_win)
+ elif downloader=='curl':
+ runwithsubprocess(f"curl -Lo {filepath_s} {todownload_s}", folder_win)
+ elif downloader=='aria2':
+ # checkaria = subprocess.getoutput(ariapath)
+ # if "is not recognized" in checkaria or "cannot find the path" in checkaria:
+ if not os.path.exists(ariapath):
+ tempcondition = currentcondition
+ currentcondition = "Installing aria2 Windows..."
+ print('[1;32mInstalling aria2 Windows...')
+ print('[0m')
+ ariaziplink = "https://github.com/q3aql/aria2-static-builds/releases/download/v1.36.0/aria2-1.36.0-win-64bit-build2.7z"
+ print(ariaziplink)
+ runwithsubprocess("curl -Lo " + shlex.quote(ariazippath) + " " + ariaziplink, batchlinksinstallpath)
+ sevenzpath = install7zWin()
+ runwithsubprocess(f"{shlex.quote(sevenzpath)} x {shlex.quote(ariazippath)} -o{shlex.quote(batchlinksinstallpath)}", batchlinksinstallpath, False, '7z')
+ print()
+ print('[1;32maria2 Windows installed!')
+ print('[0m')
+ currentcondition = tempcondition
+ # ariamode = True
+ runwithsubprocess(f"{shlex.quote(ariapath)} --summary-interval=1 --console-log-level=error --check-certificate=false -c -x 16 -s 16 -k 1M {todownload_s} -d {folder_s} -o {ariafilename_s}", folder_win, False, 'aria2')
+ else: #non-windows
+ if downloader=='gdown':
+ printdebug(f"debug gdown {todownload_s} -O {filepath_s}")
+ runwithsubprocess(f"gdown {todownload_s} -O {filepath_s}", folder_s)
+ elif downloader=='wget':
+ runwithsubprocess(f"wget -O {filepath_s} {todownload_s} --progress=bar:force", folder_s)
+ elif downloader=='curl':
+ runwithsubprocess(f"curl -Lo {filepath_s} {todownload_s}", folder_s)
+ # curdir = os.getcwd()
+ # os.rename(os.path.join(curdir, filename), filepath)
+ elif downloader=='aria2':
+ ariachecker = "dpkg-query -W -f='${Status}' aria2"
+ checkaria = subprocess.getoutput(ariachecker)
+ if "no packages found matching aria2" in checkaria:
+ tempcondition = currentcondition
+ currentcondition = "Installing aria2..."
+ print('[1;32mInstalling aria2 ...')
+ print('[0m')
+ runwithsubprocess(f"apt -y update -qq")
+ runwithsubprocess(f"apt -y install -qq aria2")
+ print('[1;32maria2 installed!')
+ print('[0m')
+ currentcondition = tempcondition
+ # ariamode = True
+ runwithsubprocess(f"aria2c --summary-interval=1 --console-log-level=error -c -x 16 -s 16 -k 1M {todownload_s} -d {folder_s} -o {ariafilename_s}", folder_s, False, 'aria2')
+ printdebug("\nmode: " + mode)
+ if mode=='debugevery':
+ time.sleep(2)
+ try:
+ os.rename(filepath, os.path.join(folder, f"{os.path.splitext(filename)[0]}-{downloader}{os.path.splitext(filename)[1]}"))
+ printdebug("renamed to " + f"{os.path.splitext(filename)[0]}-{downloader}{os.path.splitext(filename)[1]}")
+ except FileNotFoundError or FileExistsError:
+ printdebug("rename failed somehow")
+ pass
+ elif mode=='civitdebugevery':
+ time.sleep(2)
+ printdebug("debug filename: " + str(filename))
+ printdebug("debug filename_s: " + str(filename_s))
+ printdebug("debug filepath: " + str(filepath_s))
+ printdebug("debug todownload_s: " + str(todownload_s))
+ printdebug("debug folder_s: " + str(folder_s))
+ try:
+ os.rename(folder, os.path.join(folder_s, f"{os.path.splitext(filename)[0]}-{downloader}{os.path.splitext(filename)[1]}"))
+ printdebug("renamed to " + f"{os.path.splitext(filename)[0]}-{downloader}{os.path.splitext(filename)[1]}")
+ except FileNotFoundError or FileExistsError:
+ printdebug("rename failed somehow")
+ pass
+ if torename and prockilled == False and filename != torename and downloader != 'aria2':
+ def saferename(oldpath, newpath):
+ try:
+ os.rename(oldpath, newpath)
+ except Exception as e:
+ print("Rename failed. Reason: " + str(e))
+ pass
+
+ saferename(filepath, os.path.join(folder, shlex.quote(torename)))
+ if mode=='civit0' and prockilled == False:
+ # if torename:
+ # filepath = os.path.join(folder, torename)
+ try:
+ if os.path.exists(filepath):
+ if os.path.getsize(filepath) <= 5 * 1024:
+ try:
+ with open(filepath, "r", encoding="utf-8") as file:
+ if "We'll be right back | Civitai" in file.read():
+ prevciviterror = True
+ print('[1;31mCivitAI website is currently down ツ')
+ print('[0m')
+ except Exception as e:
+ print("File size checking failed. Reason: " + str(e))
+ pass
+ except Exception as e:
+ print("File size checking failed. Reason: " + str(e))
+ pass
+ if mode=='dropbox' and prockilled == False:
+ if os.path.exists(filepath):
+ if os.path.getsize(filepath) <= 1024:
+ print('[1;31mDropbox filesize below 1kb')
+ print("There's a chance that the file got too much traffic and dropbox blocked access to it")
+ print('[0m')
+ # if prockilled == True:
+ # #rewind_folder(folder_s)
+ # pass
+
+def install7zWin(): #@note install7z
+ #usage: sevenzpath = install7zWin()
+ global currentcondition
+ tempcondition = currentcondition
+ currentcondition = "Installing 7z..."
+ localappdata = os.environ['LOCALAPPDATA']
+ batchlinksinstallpath = os.path.join(localappdata, "batchlinks")
+ sevenzrpath = os.path.join(batchlinksinstallpath, "7zr.exe")
+ sevenzrlink = "https://www.7-zip.org/a/7zr.exe"
+ svnzpacklink = "https://7-zip.org/a/7z2201-x64.exe"
+ svnzpackpath = os.path.join(batchlinksinstallpath, "7z2201-x64.exe")
+ svnzexecpath = os.path.join(batchlinksinstallpath, "7z.exe")
+ if not os.path.exists(sevenzrpath):
+ print(sevenzrlink)
+ runwithsubprocess("curl -Lo " + shlex.quote(sevenzrpath) + " " + sevenzrlink, batchlinksinstallpath)
+ if not os.path.exists(svnzpackpath):
+ print(svnzpacklink)
+ runwithsubprocess("curl -Lo " + shlex.quote(svnzpackpath) + " " + svnzpacklink, batchlinksinstallpath)
+ if not os.path.exists(svnzexecpath):
+ runwithsubprocess(f"{shlex.quote(sevenzrpath)} x {shlex.quote(svnzpackpath)} -p- -o{shlex.quote(batchlinksinstallpath)} -y -sdel -bb0", batchlinksinstallpath, False, '7z')
+ currentcondition = tempcondition
+ return svnzexecpath
+
+def savestate_folder(folder):
+ global currentfoldertrack
+ currentfoldertrack = []
+ listfile = os.listdir(folder)
+ for file in listfile:
+ pathoffile = os.path.join(folder, file)
+ currentfoldertrack.append(pathoffile)
+
+def rewind_folder(folder):
+ listfilenew = os.listdir(folder)
+ newerfoldertrack = []
+ for file in listfilenew:
+ pathoffile = os.path.join(folder, file)
+ newerfoldertrack.append(pathoffile)
+ toremove = [x for x in newerfoldertrack if x not in currentfoldertrack]
+ printdebug("\ndebug toremove: " + str(toremove))
+ print()
+ for fileordir in toremove:
+ if os.path.exists(fileordir):
+ if os.path.isdir(fileordir):
+ shutil.rmtree(fileordir)
+ print("Removed incomplete download: " + fileordir)
+ else:
+ os.remove(fileordir)
+ print("Removed incomplete download: " + fileordir)
+
+def writeall(olddict, shellonly, custompaths=''):
+ newdict = trackall()
+ global finalwrite
+ finalwrite = []
+
+ finalwrite.append("All done!")
+ if custompaths:
+ finalwrite.append("⬇️Custom path added:⬇️")
+ for hashtag, thepath in custompaths.items():
+ finalwrite.append(f"{hashtag} -> {thepath}")
+ finalwrite.append("Downloaded files: ")
+
+ for oldtype, olddir in olddict.items():
+ for newtype, newdir in newdict.items():
+ if newtype == oldtype:
+ s = set(olddir)
+ trackcompare = [x for x in newdir if x not in s]
+ if len(trackcompare) > 0:
+ exec(f"finalwrite.append('⬇️' + {newtype}path + '⬇️')")
+ for item in trackcompare:
+ finalwrite.append(item)
+ if bool(remaininglinks):
+ finalwrite.append("(There are still some files that have not been downloaded. Click the 'Resume Download' button to load the links that haven't been downloaded.)")
+ printvardebug(finalwrite)
+
+ if len(finalwrite) > 1 and "Downloaded files:" in finalwrite[1] and len(finalwrite) < 3:
+ finalwrite.append("(Not finding something here? Check the terminal/colab console)")
+
+ finaloutput = list_to_text(finalwrite)
+ finalwrite = []
+ if shellonly:
+ return "Commands executed successfully."
+ else:
+ return finaloutput
+
+def writepart(box, path):
+ global finalwrite
+ if len(box) > 0:
+ finalwrite.append("⬇️" + path + "⬇️")
+ for item in box:
+ finalwrite.append(item)
+
+def trackall():
+ filesdict = dict()
+ for x in typemain:
+ if x == "altmodel" and altmodelpath == modelpath:
+ continue
+ exec(f"os.makedirs({x}path, exist_ok=True)")
+ exec(f"filesdict['{x}'] = os.listdir({x}path)")
+ return filesdict
+
+def currentfoldertohashtag(folder):
+ for x in typemain:
+ checkpath = str()
+ checkpath = eval(x+'path')
+ printdebug("checkpath: " + checkpath)
+ if str(folder).strip() == checkpath:
+ thehashtag = "#" + x
+ printdebug("thehashtag: " + thehashtag)
+ return thehashtag
+ return "#debug"
+
+def splitrename(linkcurrent):
+ renamecurrent = ''
+ if ">" in linkcurrent:
+ file_rename = linkcurrent.split(">")
+ file_rename = [file_rename.strip() for file_rename in file_rename]
+ linkcurrent = file_rename[0]
+ if file_rename[1]:
+ renamecurrent = file_rename[1]
+ return linkcurrent, renamecurrent
+
+def extractcurdir(currentdir): #@note extractcurdir
+ allfileshere = os.listdir(currentdir)
+ szfileall = []
+ if platform.system() == "Windows":
+ sevenzpath = install7zWin()
+ global currentcondition
+ extensiontoextract = [".zip", ".rar", ".7z", ".tar"]
+ for filehere in allfileshere:
+ if filehere.endswith(tuple(extensiontoextract)):
+ szpath = os.path.join(currentdir, filehere)
+ szfileall.append(szpath)
+ for szfile in szfileall:
+ if prockilled == False:
+ # currentcondition = "Extracting" + os.path.basename(szfile) + "..."
+ if platform.system() == "Windows":
+ runwithsubprocess(f"{shlex.quote(sevenzpath)} x {shlex.quote(szfile)} -p- -o{shlex.quote(currentdir)} -y -sdel -bb0", currentdir, False, '7z')
+ else:
+ runwithsubprocess(f"7z x {shlex.quote(szfile)} -p- -o{shlex.quote(currentdir)} -y -sdel -bb0", currentdir, False, '7z')
+
+#@stopwatch #the decorator mess with the progress bar #@note run
+def run(command, choosedowner, civitdefault, civitpruned, civitvae, progress=gr.Progress()):
+ progress(0.01, desc='')
+ global prockilled
+ prockilled = False
+ global everyprocessid
+ everyprocessid = []
+ everymethod = False
+ global currentcondition
+ resumebuttonvisible = False
+ if command.strip().startswith('https://pastebin.com/') and command.strip().count('\n') == 0:
+ currentcondition = f'Done.'
+ if gradiostate == True:
+ return ["Use the 'Copy from Pastebin' button instead", gr.Dataframe.update(value=buildarrayofhashtags('bottom'))] #gr.Dataframe.update(value=buildarrayofhashtags('right')),
+ else:
+ return ["Use the 'Copy from Pastebin' button instead", gr.Dataframe.update(value=buildarrayofhashtags('bottom')), gr.Button.update(visible=resumebuttonvisible)] #gr.Dataframe.update(value=buildarrayofhashtags('right')),
+
+ if command.strip() == '@debugresetdownloads' and snapshot != {} and globaldebug == True:
+ currentcondition = f'Removing downloaded files...'
+ removed_files = global_rewind()
+ texttowrite = ["⬇️Removed files⬇️"]
+ for item in removed_files:
+ texttowrite.append(item)
+ writefinal = list_to_text(texttowrite)
+ currentcondition = f'Removing done.'
+ if gradiostate == True:
+ return [writefinal, gr.Dataframe.update(value=buildarrayofhashtags('bottom'))] #gr.Dataframe.update(value=buildarrayofhashtags('right')),
+ else:
+ return [writefinal, gr.Dataframe.update(value=buildarrayofhashtags('bottom')), gr.Button.update(visible=resumebuttonvisible)] #gr.Dataframe.update(value=buildarrayofhashtags('right')),
+
+ if not command.strip():
+ currentcondition = "Logging activated."
+ texttowrite = ["The link box is empty."]
+ writefinal = list_to_text(texttowrite)
+ if gradiostate == True:
+ return [writefinal, gr.Dataframe.update(value=buildarrayofhashtags('bottom'))] #gr.Dataframe.update(value=buildarrayofhashtags('right'))
+ else:
+ return [writefinal, gr.Dataframe.update(value=buildarrayofhashtags('bottom')), gr.Button.update(visible=resumebuttonvisible)] #gr.Dataframe.update(value=buildarrayofhashtags('right')),
+ oldfilesdict = trackall()
+ if cmd_opts.ckpt_dir:
+ altmodelpath = cmd_opts.ckpt_dir
+ currentfolder = altmodelpath
+ else:
+ altmodelpath = os.path.join(models_path, "Stable-diffusion")
+ currentfolder = modelpath
+ currenthashtag = '#model'
+ os.makedirs(currentfolder, exist_ok=True)
+ currentcondition = 'Extracting links...'
+ links = extract_links(command)
+ isshell = True
+ for listpart in links:
+ if not listpart.startswith('!'):
+ isshell = False
+ break
+ printdebug("links: " + str(links))
+ steps = float(0)
+ totalsteps = float(1)
+
+ usemega = False
+ usegdrive = False
+ usemediafire = False
+ # global ariamode
+ global gdownupgraded
+ global mediafireinstalled
+ for item in links:
+ if not item.startswith('#'):
+ totalsteps += 1
+ if item.startswith('https://mega.nz'):
+ usemega = True
+ if item.startswith('https://drive.google.com'):
+ usegdrive = True
+ if item.startswith('https://www.mediafire.com/file'):
+ usemediafire = True
+
+ #break
+ printdebug("totalsteps: " + str(totalsteps))
+ if usemega == True:
+ currentcondition = 'Installing Mega...'
+ progress(0.01, desc='Installing Mega...')
+ if platform.system() == "Windows":
+ installmegawin()
+ else:
+ installmega()
+ if usegdrive == True and gdownupgraded == False:
+ tempcondition = currentcondition
+ currentcondition = "Upgrading gdown..."
+ print('[1;32mUpgrading gdown ...')
+ print('[0m')
+ runwithsubprocess(f"pip3 install -q --upgrade --no-cache-dir gdown")
+ print('[1;32mgdown upgraded!')
+ print('[0m')
+ currentcondition = tempcondition
+ gdownupgraded = True
+ if usemediafire == True and mediafireinstalled == False:
+ tempcondition = currentcondition
+ currentcondition = "Installing mediafire-dl..."
+ print('[1;32mInstalling mediafire-dl...')
+ print('[0m')
+ runwithsubprocess(f"pip3 install git+https://github.com/Juvenal-Yescas/mediafire-dl")
+ print('[1;32mmediafire-dl installed!')
+ print('[0m')
+ currentcondition = tempcondition
+ mediafireinstalled = True
+
+ print('[1;32mBatchLinks Downloads starting...')
+ print('[0m')
+ printdebug('prockilled: ' + str(prockilled))
+ global remaininglinks
+ batchtime = time.time()
+ addedcustompath = dict()
+ downmethod = ['gdown', 'wget', 'curl', 'aria2']
+ hfmethods = [
+ "https://raw.githubusercontent.com",
+ "https://huggingface.co",
+ "https://cdn.discordapp.com/attachments"
+ ]
+ global typemain
+ global typechecker
+ for listpart in links:
+ if prockilled == False:
+ currenttorename = ''
+ printdebug("steps: " + str(steps))
+ printdebug("total steps: " + str(totalsteps))
+ printdebug("percentage: " + str(round(steps/totalsteps, 1)))
+ printdebug("currenttypemain: " + str(typemain))
+ # ariamode = False
+ if gradiostate == False:
+ if time.time() - batchtime >= 70:
+ remaininglinks = links[links.index(listpart):]
+ printdebug("remaining links: " + str(remaininglinks))
+ if bool(remaininglinks):
+ printdebug("currentfolder: " + currentfolder)
+ tophashtag = currentfoldertohashtag(currentfolder)
+ printdebug("tophashtag: " + tophashtag)
+ remaininglinks.insert(0, tophashtag)
+ printdebug("remaining links new: " + str(remaininglinks))
+ print()
+ print('[1;33mRuntime was stopped to prevent hangs.')
+ print("[1;33mCheck the UI and press 'Resume Download' to load the remaining links")
+ print("[1;33mThen click 'Download All!' again")
+ print('[0m')
+ print("These are some links that haven't been downloaded yet.👇")
+ printremains = list_to_text(remaininglinks)
+ print(printremains)
+ resumebuttonvisible = True
+ cancelrun()
+ break
+
+ if listpart.startswith("https://mega.nz"):
+ currentlink, currenttorename = splitrename(listpart)
+ print('\n')
+ print(currentlink)
+ currentcondition = f'Downloading {currentlink}...'
+ progress(round(steps/totalsteps, 3), desc='Downloading from ' + os.path.basename(currentlink).split('#')[0] + f' into {currenthashtag}...')
+ transfare(currentlink, currentfolder, currenttorename)
+ steps += 1
+
+ elif listpart.startswith(tuple(hfmethods)):
+ # elif listpart.startswith("https://huggingface.co") or listpart.startswith("https://raw.githubusercontent.com") or listpart.startswith("https://cdn.discordapp.com/attachments"):
+ currentlink, currenttorename = splitrename(listpart)
+ print('\n')
+ print(currentlink)
+ currentcondition = f'Downloading {currentlink}...'
+ progress(round(steps/totalsteps, 3), desc='Downloading ' + os.path.basename(currentlink) + f' into {currenthashtag}...')
+ if everymethod == False:
+ hfdown(currentlink, currentfolder, choosedowner, 'default', currenttorename)
+ else:
+ for xmethod in downmethod:
+ if prockilled == False:
+ hfdown(currentlink, currentfolder, xmethod, 'debugevery')
+ steps += 1
+
+ elif listpart.startswith("https://www.dropbox.com/s"): #@note dropbox
+ currentlink, currenttorename = splitrename(listpart)
+ if currentlink.endswith("?dl=0"):
+ currentlink = currentlink.split("?dl=")[0] + "?dl=1"
+ realname = currentlink.split("/")[-1].split("?dl=")[0]
+ if currenttorename == '':
+ currenttorename = realname
+ print('\n')
+ print(currentlink)
+ currentcondition = f'Downloading {currentlink}...'
+ progress(round(steps/totalsteps, 3), desc='Downloading ' + currenttorename + f' into {currenthashtag}...')
+ hfdown(currentlink, currentfolder, choosedowner, 'dropbox', currenttorename)
+ steps += 1
+
+ elif listpart.startswith("https://drive.google.com"):
+ currentlink, currenttorename = splitrename(listpart)
+ print('\n')
+ print(currentlink)
+ currentcondition = f'Downloading {currentlink}...'
+ match = re.search(r'\?id=([^\&]+)\&export|/d/([^\s/]+)/', currentlink)
+ if match:
+ if match.group(1):
+ extracted_string = match.group(1)
+ else:
+ extracted_string = match.group(2)
+ progress(round(steps/totalsteps, 3), desc='Downloading from ' + extracted_string + f' into {currenthashtag}...')
+ mediadrivedown(currentlink, currentfolder, 'gdrive', currenttorename)
+ steps += 1
+
+ elif listpart.startswith("https://pixeldrain.com"): #@note pixeldrain
+ currentlink, currenttorename = splitrename(listpart)
+ if not currentlink.startswith("https://pixeldrain.com/api/file/"):
+ fileid = currentlink.split("/")[-1]
+ currentlink = f"https://pixeldrain.com/api/file/{fileid}"
+ currentcondition = f'Retrieving Pixeldrain link...'
+ searcher = "findstr" if platform.system() == "Windows" else "grep"
+ try:
+ filename = subprocess.getoutput(f"curl -sI {currentlink} | {searcher} -i Content-Disposition").split('filename="', 1)[1].rsplit('"', 1)[0]
+ except IndexError:
+ print("Something wrong while retrieving the Pixeldrain link")
+ continue
+ if currenttorename == '':
+ currenttorename = filename
+ print('\n')
+ print(currentlink)
+ currentcondition = f'Downloading {currentlink}...'
+ progress(round(steps/totalsteps, 3), desc='Downloading ' + currenttorename + f' into {currenthashtag}...')
+ # if everymethod == False:
+ hfdown(currentlink, currentfolder, choosedowner, 'pixeldrain', currenttorename)
+ # else:
+ # for xmethod in downmethod:
+ # if prockilled == False:
+ # hfdown(currentlink, currentfolder, xmethod, 'debugevery')
+ steps += 1
+
+ elif listpart.startswith("https://www.mediafire.com/file"): #@note mediafire
+ currentlink, currenttorename = splitrename(listpart)
+ print('\n')
+ print(currentlink)
+ currentcondition = f'Downloading {currentlink}...'
+ progress(round(steps/totalsteps, 3), desc='Downloading ' + currentlink.split("/")[-2] + f' into {currenthashtag}...')
+ # if everymethod == False:
+ mediadrivedown(currentlink, currentfolder, 'mediafire', currenttorename)
+ # else:
+ # for xmethod in downmethod:
+ # if prockilled == False:
+ # hfdown(currentlink, currentfolder, xmethod, 'debugevery')
+ steps += 1
+
+ elif listpart.startswith("https://anonfiles.com"): #@note anonfiles
+ currentlink, currenttorename = splitrename(listpart)
+ print('\n')
+ print(currentlink)
+
+ currentcondition = f'Retrieving anonfiles link...'
+ # print(filename)
+ # Send HTTP request to the website and read the response
+ response = urllib.request.urlopen(currentlink)
+ html_content = response.read().decode('utf-8')
+
+ # Find all links that contain "anonfiles" in them using regular expressions
+ download_links = re.findall(r'href=["\'](https?:\/\/.*?anonfiles.*?)["\']', html_content)
+ currentlink = max(download_links, key=len)
+
+ currentcondition = f'Downloading {currentlink}...'
+ progress(round(steps/totalsteps, 3), desc='Downloading ' + currentlink.split("/")[-1] + f' into {currenthashtag}...')
+ if everymethod == False:
+ hfdown(currentlink, currentfolder, choosedowner, 'default', currenttorename)
+ else:
+ for xmethod in downmethod:
+ if prockilled == False:
+ hfdown(currentlink, currentfolder, xmethod, 'debugevery')
+ steps += 1
+
+ elif listpart.startswith("https://files.catbox.moe"):
+ currentlink, currenttorename = splitrename(listpart)
+ print('\n')
+ print(currentlink)
+ try:
+ urllib.request.urlopen(currentlink)
+ except http.client.RemoteDisconnected:
+ print('[1;31mConnection to ' + currentlink + ' failed.')
+ print("This colab session's server might doesn't have access to catbox")
+ print('[0m')
+ continue
+ except urllib.error.URLError as e:
+ print('[1;31mConnection to ' + currentlink + ' failed.')
+ print("This colab session's server might doesn't have access to catbox")
+ print('[0m')
+ continue
+ print(currentlink)
+ currentcondition = f'Downloading {currentlink}...'
+ progress(round(steps/totalsteps, 3), desc='Downloading ' + os.path.basename(currentlink) + f' into {currenthashtag}...')
+ if everymethod == False:
+ hfdown(currentlink, currentfolder, choosedowner, 'default', currenttorename)
+ else:
+ for xmethod in downmethod:
+ if prockilled == False:
+ hfdown(currentlink, currentfolder, xmethod, 'debugevery')
+ steps += 1
+
+ elif listpart.startswith("https://civitai.com/api/download/models/"): #@note civit direct
+ usenewmethod = True
+ currentlink, currenttorename = splitrename(listpart)
+ if currenttorename == '':
+ currenttorename = getcivitname(listpart)
+ if currenttorename == 'batchlinksold':
+ usenewmethod = False
+ elif currenttorename == 'batchlinksskip':
+ continue
+ # print("That CivitAI link no longer exist, or the server is currently down.")
+ # continue
+
+ print('\n')
+ print(currentlink)
+ currentcondition = f'Downloading {currentlink}...'
+ if everymethod == False:
+ if usenewmethod:
+ progress(round(steps/totalsteps, 3), desc='Downloading ' + currenttorename + f' into {currenthashtag}...')
+ hfdown(currentlink, currentfolder, choosedowner, 'civit0', currenttorename)
+ else:
+ progress(round(steps/totalsteps, 3), desc='Downloading model number ' + os.path.basename(currentlink) + '...')
+ civitdown(currentlink, currentfolder, currenttorename)
+ if not prevciviterror:
+ configlink = checkcivitconfig(currentlink)
+ if not configlink=='':
+ namefile= os.path.splitext(currenttorename.split('?')[0])[0]
+ currenttorename = namefile + '.yaml'
+ hfdown(configlink, currentfolder, choosedowner, 'civit0', currenttorename)
+ else:
+ for xmethod in downmethod:
+ if prockilled == False:
+ hfdown(currentlink, currentfolder, xmethod, 'debugevery')
+ # civitdown(currentlink, currentfolder, currenttorename)
+ steps += 1
+
+ elif listpart.startswith("https://github.com"):
+ currentlink, currenttorename = splitrename(listpart)
+ print('\n')
+ print(currentlink)
+ if '/raw/' in listpart or '/releases/download/' in listpart:
+ currentcondition = f'Downloading {currentlink}...'
+ progress(round(steps/totalsteps, 3), desc='Downloading ' + os.path.basename(currentlink) + f' into {currenthashtag}...')
+ if everymethod == False:
+ hfdown(currentlink, currentfolder, choosedowner, 'default', currenttorename)
+ else:
+ for xmethod in downmethod:
+ if prockilled == False:
+ hfdown(currentlink, currentfolder, xmethod, 'debugevery')
+ else:
+ splits = listpart.split('#')[0].split("/")
+ currentlink = "/".join(splits[:5])
+ foldername = listpart.split('#')[0].rsplit('/', 1)[-1]
+ folderpath = os.path.join(extpath, foldername)
+ currentcondition = f'Cloning {currentlink}...'
+ progress(round(steps/totalsteps, 3), desc='Cloning from ' + currentlink.split('/', 3)[-1] + f' into #ext...')
+ if platform.system() == "Windows":
+ runwithsubprocess(f"git clone {currentlink} {shlex.quote(folderpath)}")
+ else:
+ runwithsubprocess(f"git clone {currentlink} {folderpath}")
+ steps += 1
+
+ elif listpart.startswith("https://civitai.com/models/"):
+ currentlink, currenttorename = splitrename(listpart)
+ print('\n')
+ print(currentlink)
+ currentcondition = f'Downloading {currentlink}...'
+ #customtypemains = list
+ progress(round(steps/totalsteps, 3), desc='Downloading ' + os.path.basename(currentlink) + f'...')
+ for tag in tuple((typemain[countofdefaulthashtags:])):
+ if "#" + tag == currenthashtag and gradiostate:
+ progress(round(steps/totalsteps, 3), desc='Downloading ' + os.path.basename(currentlink) + f' into {currenthashtag}...')
+ pass
+ break
+ if everymethod == False:
+ civitdown2(currentlink, currentfolder, choosedowner, currenttorename, False, civitdefault, civitpruned, civitvae)
+ # else:
+ # for xmethod in downmethod:
+ # if prockilled == False:
+ # civitdown2(currentlink, currentfolder, xmethod, True)
+ steps += 1
+
+ elif listpart.startswith("!"):
+ commandtorun = listpart[1:]
+ currentcondition = f'Running command: {commandtorun}'
+ progress(round(steps/totalsteps, 3), desc=currentcondition)
+ runwithsubprocess(commandtorun, None, True)
+ steps += 1
+
+ elif listpart.startswith("@debugeverymethod") and globaldebug == True and gradiostate == True:
+ print('\n')
+ everymethod = True
+ print('[1;32mDebugEveryMethod activated!')
+ print('[1;32mOne link will be downloaded with every possible download method.')
+ print('[0m')
+
+ elif listpart.startswith("@debugresetdownloads") and snapshot != {} and globaldebug == True:
+ print('\n')
+ currentcondition = f'Removing downloaded files...'
+ removed_files = global_rewind()
+ oldfilesdict = trackall()
+ texttowrite = ["⬇️Removed files⬇️"]
+ for item in removed_files:
+ texttowrite.append(item)
+ writefinal = list_to_text(texttowrite)
+ printdebug(str(writefinal))
+
+ elif listpart.startswith("@extract"): #@note hashtagextract
+ print('\n')
+ currentcondition = 'Extracting every archive file in current directory...'
+ print('Extracting every archive file in current directory...\n')
+ extractcurdir(currentfolder)
+
+ elif listpart.startswith("@new"): #@note hashtagcustom
+ newcommand, newhashtag, newpath = shlex.split(listpart)
+ if newcommand and newhashtag and newpath:
+ if newhashtag.startswith("#"):
+ printdebug("making custom hashtag")
+ newtype = newhashtag[1:]
+ #global typemain #moved to top
+ #global typechecker #moved to top
+ if not newtype[0].isdigit():
+ if not newtype in typemain and not newpath in typechecker:
+ try:
+ typemain.append(newtype)
+ printdebug('typemain: ' + str(typemain))
+ typechecker.append(newtype)
+ printdebug('typechecker: ' + str(typechecker))
+ newglobalpath = newtype + "path"
+ printdebug('newglobalpath: ' + newtype + "path")
+ newpath = os.path.abspath(os.path.normpath(newpath).rstrip(os.sep))
+ os.makedirs(newpath, exist_ok=True)
+ globals()[newglobalpath] = newpath
+ printdebug("modelpath = " + eval(newglobalpath))
+ oldfilesdict[newtype] = os.listdir(newpath)
+ # global addedcustompath
+ addedcustompath[newhashtag] = newpath
+ printdebug("addedcustompath: " + str(addedcustompath))
+ print(f"New custom path added!\n{newhashtag} means {newpath}")
+ except Exception as e:
+ print("Adding custom path failed! Reason: " + str(e))
+ else:
+ print("Adding custom path failed! Reason: Custom hashtag name cannot starts with a number")
+
+ elif listpart.startswith("@aria") or listpart.startswith("@aria2"): #@note customaria
+
+ # checkariacommand = ['##', '>']
+ printvardebug(listpart)
+ if "##" in listpart:
+ listpart = listpart.split('##')[0]
+ if ":\\" in listpart: #windows path
+ listpart = listpart.replace('\\', '\\\\').replace('"', '\\"')
+ ariacmd = shlex.split(listpart)
+ printvardebug(ariacmd)
+ arialink, ariarename, ariapath = '', '', ''
+ renamedalready = False
+ custompath = False
+ # startcomment = False
+ if (ariacmd[0] == '@aria2' or ariacmd[0] == '@aria') and len(ariacmd) > 1: #two items. @aria and link
+ if ariacmd[1].startswith('http'):
+ arialink = ariacmd[1]
+
+ if len(ariacmd) > 2: #three items. @aria, link, and path
+ if ariacmd[2].startswith(">") and len(ariacmd) > 3: #four items. @aria, link, '>', and rename (no custom path)
+ ariarename = shlex.quote(ariacmd[3])
+ renamedalready = True
+ else:
+ if ariacmd[2].startswith('#'): #three items. @aria, link, hashtagpath
+ tobeariapath, _ = hashtagtopath(ariacmd[2])
+ if tobeariapath:
+ ariapath = tobeariapath
+ else: #three items. @aria, link, custompath
+ # ariapath = shlex.quote(ariacmd[2])
+ ariapath = ariacmd[2]
+ custompath = True #message for file downloaded to custom path will be added later
+ # if len(cmd) > 3:
+ # if cmd[3].startswith('>'):
+ # renaming = True
+ # else:
+ # renaming = False
+ if len(ariacmd) > 4 and ariacmd[3].startswith('>') and not renamedalready: #five items. @aria, link, path, '>', and rename
+ ariarename = shlex.quote(ariacmd[4])
+
+ if not ariapath:
+ ariapath = currentfolder
+
+ if not ariarename:
+ ariarename = arialink.rsplit('/', 1)[-1]
+
+ #finalcommand = f"aria2c --summary-interval=1 --console-log-level=error -c -x 16 -s 16 -k 1M {arialink} -d {ariapath} -o {ariarename}"
+ printvardebug(arialink)
+ printvardebug(ariapath)
+ printvardebug(ariarename)
+ if arialink and not prockilled:
+ try:
+ currentcondition = f'Downloading from {arialink} into {ariapath}...'
+ hfdown(arialink, ariapath, 'aria2', 'default', ariarename)
+ except Exception as e:
+ print(f"Custom aria download failed. Reason: {str(e)}")
+
+ elif listpart.startswith("#") and listpart.endswith(tuple(typemain)): #tuple(typemain[countofdefaulthashtags:])
+ try:
+ printdebug("one of typemain")
+ currenthashtag = listpart
+ currentfolder = eval(listpart[1:] + "path")
+ os.makedirs(currentfolder, exist_ok=True)
+ except Exception as e:
+ print(f"Cannot use hashtag: {str(e)}")
+
+ else:
+ tobecurrentfolder, tobecurrenthashtag = hashtagtopath(listpart)
+ if tobecurrentfolder:
+ currentfolder = tobecurrentfolder
+ if tobecurrentfolder:
+ currenthashtag = tobecurrenthashtag
+
+ else:
+ currentcondition = 'Operation cancelled'
+ return "Operation cancelled"
+
+ currentcondition = 'Writing output...'
+ downloadedfiles = writeall(oldfilesdict, isshell, addedcustompath)
+ for tokill in everyprocessid:
+ try:
+ os.kill(tokill, signal.SIGTERM)
+ except ProcessLookupError:
+ pass
+ except PermissionError:
+ pass
+ except OSError:
+ pass
+ print()
+ print('[1;32mBatchLinks Downloads finished!')
+ print('[0m')
+ currentcondition = 'Done!'
+ printdebug(f"this should be the output:\n" + str(downloadedfiles))
+ progress(1.00, desc='')
+ if gradiostate == True:
+ return [downloadedfiles, gr.Dataframe.update(value=buildarrayofhashtags('bottom'))] #@note dataframe #gr.Dataframe.update(value=buildarrayofhashtags('right')), was here
+ else:
+ return [downloadedfiles, gr.Dataframe.update(value=buildarrayofhashtags('bottom')), gr.Button.update(visible=resumebuttonvisible)] #gr.Dataframe.update(value=buildarrayofhashtags('right')), was here
+
+def hashtagtopath(thehashtag):
+ hashtagcurrent, foldercurrent = '',''
+ notbreaking = True
+ typemainlocal = []
+ for x in typemain:
+ typemainlocal.append(x)
+ for y in typemainlocal:
+ if thehashtag[1:] == y:
+ printdebug("one of typemain, found on else")
+ hashtagcurrent = thehashtag
+ foldercurrent = eval(thehashtag[1:] + "path")
+ os.makedirs(foldercurrent, exist_ok=True)
+ notbreaking = False
+ for prefix in typechecker:
+ if thehashtag.startswith("#" + prefix) and notbreaking:
+ if prefix in ["embedding", "embeddings", "embed", "embeds","textualinversion", "ti"]:
+ hashtagcurrent = '#embed'
+ elif prefix in ["model", "models", "checkpoint", "checkpoints"]:
+ hashtagcurrent = '#model'
+ elif prefix in ["vae", "vaes"]:
+ hashtagcurrent = '#vae'
+ elif prefix in ["lora", "loras"]:
+ hashtagcurrent ='#lora'
+ elif prefix in ["hypernetwork", "hypernetworks", "hypernet", "hypernets", "hynet", "hynets",]:
+ hashtagcurrent = '#hynet'
+ elif prefix in ["addnetlora", "loraaddnet", "additionalnetworks", "addnet"]:
+ hashtagcurrent = '#addnetlora'
+ elif prefix in ["controlnet", "cnet"]:
+ hashtagcurrent = '#cnet'
+ elif prefix in ["extension", "extensions", "ext"]:
+ hashtagcurrent = '#ext'
+ elif prefix in ["aestheticembedding", "aestheticembed"]:
+ hashtagcurrent = '#aestheticembed'
+ elif prefix in ["upscaler", "upscale"]:
+ hashtagcurrent = '#upscaler'
+ elif prefix in ["altmodel", "altmodels"]:
+ hashtagcurrent = '#altmodel'
+ elif prefix in ["lycoris", "locon", "loha"]:
+ hashtagcurrent = '#lycoris'
+ try:
+ foldercurrent = eval(hashtagcurrent[1:] + 'path')
+ except Exception as e:
+ print(f"Cannot use hashtag: {e}")
+ continue
+
+ os.makedirs(foldercurrent, exist_ok=True)
+
+ return foldercurrent, hashtagcurrent
+
+wildcardcommand = [
+ "@debugeverymethod", "@debugresetdownloads",
+ "@extract", "@aria", "@aria2", "@new"
+]
+
+def extract_links(string):
+ links = []
+ lines = string.split('\n')
+ for line in lines:
+ line = line.split('##')[0].strip()
+ if line.startswith(tuple(supportedlinks)):
+ links.append(line)
+ elif line.startswith(tuple(wildcardcommand)):
+ links.append(line)
+ elif line.startswith("!"):
+ links.append(line.strip())
+ elif line.startswith("#"):
+ links.append(line.strip())
+ # else:
+ # for prefix in typechecker:
+ # if line.startswith("#" + prefix):
+ # links.append(line)
+
+ #print(f"links: {links}")
+ return links
+
+def list_to_text(lst):
+ stripped_list = [item.strip(',').strip('\"') for item in lst]
+ return '\n'.join(stripped_list)
+
+def uploaded(textpath):
+ if not textpath is None:
+ print(textpath)
+ file_paths = textpath.name
+ print(file_paths)
+ links = []
+
+ with open(file_paths, 'r') as file:
+ for line in file:
+ if line.startswith(tuple(supportedlinks)):
+ links.append(line.strip())
+ elif line.startswith("!"):
+ links.append(line.strip())
+ elif line.startswith(tuple(wildcardcommand)):
+ links.append(line.strip())
+ elif line.startswith("#"):
+ links.append(line.strip())
+ # else:
+ # for prefix in typechecker:
+ # if line.startswith("#" + prefix):
+ # links.append(line.strip())
+
+ text = list_to_text(links)
+ return text
+
+count = 0
+def keeplog():
+ global currentcondition
+ global currentsuboutput
+ global logging
+ if logging == False:
+ currentcondition = "Logging activated."
+ currentsuboutput = ''
+ logging = True
+ return [currentcondition, gr.Button.update(visible=True), gr.Button.update(visible=False)]
+ if currentsuboutput == '':
+ return [currentcondition, gr.Button.update(visible=True), gr.Button.update(visible=False)]
+ else:
+ return [f"{currentcondition}\n{currentsuboutput}", gr.Button.update(visible=True), gr.Button.update(visible=False)]
+
+def offlog():
+ global currentcondition
+ global currentsuboutput
+ global logging
+ if logging == True:
+ currentcondition = "Logging deactivated."
+ currentsuboutput = ''
+ logging = False
+ return [f"{currentcondition}", gr.Button.update(visible=False), gr.Button.update(visible=True)]
+
+def empty():
+ return ''
+
+def cancelrun():
+ global processid
+ global prockilled
+ printdebug("debug processid: " + str(processid))
+ if not processid == '':
+ if platform.system() == "Windows":
+ global process
+ process.terminate()
+ _ = subprocess.getoutput("taskkill /F /T /PID" + str(process.pid))
+ _ = subprocess.getoutput("taskkill /f /t /im MEGAcmdServer.exe")
+ else:
+ try:
+ os.kill(processid, signal.SIGTERM)
+ except ProcessLookupError:
+ pass
+ except PermissionError:
+ pass
+ except OSError:
+ pass
+ #os.killpg(os.getpgid(processid.pid), signal.SIGTERM)
+ prockilled = True
+ if prockilled == True and globaldebug == True:
+ print()
+ print("This should kill")
+ print()
+ return ["Operation Cancelled",gr.Dataframe.update(value=buildarrayofhashtags('bottom'))]
+
+def fillbox():
+ global remaininglinks
+ if bool(remaininglinks):
+ text = list_to_text(remaininglinks)
+ remaininglinks = []
+ return [text, 'Links updated!\nClick Download All! to download the rest of the links', gr.Button.update(visible=False)]
+ return ['', '', gr.Button.update(visible=False)]
+
+if gradiostate == True:
+ storedstatedownloader = "gdown"
+else:
+ storedstatedownloader = "aria2"
+storedstatemodeltype = "safetensors"
+storedstateprecision = "fp16"
+storedstatevae = True
+
+def grchangedown(downstate):
+ global storedstatedownloader
+ storedstatedownloader = downstate
+ printvardebug(storedstatedownloader)
+
+def grchangetype(typestate):
+ global storedstatemodeltype
+ storedstatemodeltype = typestate
+ printvardebug(storedstatemodeltype)
+
+def grchangefp(fpstate):
+ global storedstateprecision
+ storedstateprecision = fpstate
+ printvardebug(storedstateprecision)
+
+def grchangevae(vaestate):
+ global storedstatevae
+ storedstatevae = vaestate
+ printvardebug(storedstatevae)
+
+def stretchui(stretch): #outputs=[boxtohide, bottomlist] #outputs=[boxtohide, downbox, civitbox, choose_downloader, civit_default, civit_ispruned, civit_alsodownvae])
+ # if stretch:
+ # return [gr.Box.update(visible=False), gr.Accordion.update(visible=False), gr.Accordion.update(visible=True)]
+ # else:
+ # return [gr.Box.update(visible=True), gr.Accordion.update(visible=True), gr.Accordion.update(visible=False)]
+ global storedstatedownloader
+ global storedstatemodeltype
+ global storedstateprecision
+ global storedstatevae
+ if stretch:
+ return [gr.Box.update(visible=False), gr.Row.update(visible=True), gr.Row.update(visible=True), gr.Radio.update(value=storedstatedownloader), gr.Radio.update(value=storedstatemodeltype), gr.Radio.update(value=storedstateprecision), gr.Checkbox.update(value=storedstatevae)]
+ else:
+ return [gr.Box.update(visible=True), gr.Row.update(visible=False), gr.Row.update(visible=False), gr.Radio.update(value=storedstatedownloader), gr.Radio.update(value=storedstatemodeltype), gr.Radio.update(value=storedstateprecision), gr.Checkbox.update(value=storedstatevae)]
+
+def hidehelp(hide):
+ if hide:
+ return [gr.Markdown.update(value=titletext), gr.Markdown.update(visible=False)]
+ else:
+ return [gr.Markdown.update(value=introductiontext), gr.Markdown.update(visible=True)]
+
+# countofdefaulthashtags = len(typemain)
+def buildarrayofhashtags(rightorbottom):
+ printdebug(f"buildarray {rightorbottom} initiated!")
+ # defaultpathtime = True
+ def writingpath(j, path):
+ if path == modelpath:
+ return path + " (default path)"
+ elif path == altmodelpath:
+ return path
+ else:
+ if rightorbottom == 'right' and j < countofdefaulthashtags:
+ return path.replace(script_path, "~")
+ else:
+ return path
+ hashtagandpath = []
+ for i, x in enumerate(typemain):
+ try:
+ xpath = eval(x+"path")
+ if cmd_opts.ckpt_dir:
+ hashtagandpath.append(["#"+x, writingpath(i, xpath)])
+ elif x != "altmodel":
+ hashtagandpath.append(["#"+x, writingpath(i, xpath)])
+ # defaultpathtime = False
+ except Exception as e:
+ print(str(e))
+ return hashtagandpath
+
+def copyfrompastebin(boxwithlink):
+ pastebinlink = boxwithlink.strip()
+ if pastebinlink.startswith('https://pastebin.com/'):
+ if pastebinlink.count('\n') == 0:
+ global currentcondition
+ currentcondition = f'Gathering links from Pastebin..'
+ if not '/raw/' in pastebinlink:
+ pastebinlink = pastebinlink.replace("pastebin.com/", "pastebin.com/raw/")
+
+ pbinresponse = requests.get(pastebinlink)
+
+ if pbinresponse.status_code == 200:
+ pbintextlist = pbinresponse.text.splitlines()
+ links = []
+ for line in pbintextlist:
+ if line.startswith(tuple(supportedlinks)):
+ links.append(line.strip())
+ elif line.startswith("!"):
+ links.append(line.strip())
+ elif line.startswith("@new"):
+ links.append(line.strip())
+ elif line.startswith(tuple(wildcardcommand)):
+ links.append(line.strip())
+ elif line.startswith("#"):
+ links.append(line.strip())
+ currentcondition = f'Done.'
+ finallinks = list_to_text(links)
+ return [finallinks, "Pastebin links retrieved successfully."]
+ else:
+ currentcondition = f'Done.'
+ print("Error retrieving data from pastebin")
+ return [boxwithlink, "Error retrieving data from pastebin"]
+ else:
+ currentcondition = f'Done.'
+ return [boxwithlink, "Pastebin link must be the only one link on the textbox! (And only one pastebin link supported)"]
+ else:
+ currentcondition = f'Done.'
+ return [boxwithlink, "Pastebin link must be the first (and the only) link on the textbox!"]
+
+titletext = f"""⬇️ Batchlinks Downloader ({currentversion}) {latestversiontext}
"""
+introductiontext = f"""
+{titletext}
+
+This tool will read the textbox and download every links from top to bottom one by one
+Put your links down below. Supported link: Huggingface, CivitAI, MEGA, Discord, Github, Catbox, Google Drive, Pixeldrain, Mediafire, Anonfiles, Dropbox
+Use hashtag to separate downloaded items based on their download location
+Valid hashtags: #embed
, #model
, #hypernet
, #lora
, #vae
, #addnetlora
, etc.
+(For colab that uses sd-webui-additional-networks extension to load LoRA, use #addnetlora
instead)
+Use double hashtag (##) after links for comment. Useful to mark which links downloads what.
+Remember to always press the 🔄️ refresh button on the UI after downloading models etc. in order for them to show up on the list.
+"""
+knowmoretext = f"""
+Click these links for more:
+Readme Page
+Example
+Syntax
+Valid Hashtags
+Here's how you can get the direct links
+Report Bug
+"""
+testboxplaceholder = f"""#model
+
+#vae
+
+#lora
+
+##this is a comment, and these text is just an example
+"""
+
+def on_ui_tabs():
+ with gr.Blocks() as batchlinks:
+ with gr.Row():
+ with gr.Column(scale=2):
+ introduction = gr.Markdown(introductiontext)
+ with gr.Column(scale=1):
+ with gr.Row():
+ uistretcher = gr.Checkbox(value=False, label="Stretch UI", interactive=True)
+ helphider = gr.Checkbox(value=False, label="Hide Help", interactive=True)
+ knowmore = gr.Markdown(knowmoretext)
+ with gr.Group():
+ command = gr.Textbox(label="Links", placeholder=testboxplaceholder, lines=5)
+ if gradiostate == True:
+ logbox = gr.Textbox(label="Log", interactive=False)
+ else:
+ if vladmandic:
+ logbox = gr.Textbox("(remove the --disable-queue args on launch.py to enable optional logging)", label="Log", interactive=False)
+ else:
+ logbox = gr.Textbox("(use --gradio-queue args on launch.py to enable optional logging)", label="Log", interactive=False)
+
+ with gr.Row():
+ with gr.Box():
+ if gradiostate == True:
+ with gr.Column():
+ # with gr.Row():
+ # gr.Textbox(value=None, interactive=False, show_label=False)
+ btn_onlog = gr.Button("Turn On Logging", variant="primary", visible=True)
+ # with gr.Row():
+ btn_offlog = gr.Button("Turn Off Logging", visible=False)
+ loggingon = btn_onlog.click(keeplog, outputs=[logbox, btn_offlog, btn_onlog], every=1)
+ btn_offlog.click(offlog, outputs=[logbox, btn_offlog, btn_onlog], cancels=[loggingon])
+ # gr.Textbox(value=None, interactive=False, show_label=False)
+ # logging = gr.Radio(["Turn On Logging"], show_label=False)
+ # logging.change(keeplog, outputs=logbox, every=1)
+ out_text = gr.Textbox(label="Output")
+ else:
+ if vladmandic:
+ print("Batchlinks webui extension: (Optional) Remove the --disable-queue args to enable logging & cancel button on this extension")
+ else:
+ print("Batchlinks webui extension: (Optional) Use --gradio-queue args to enable logging & cancel button on this extension")
+ out_text = gr.Textbox("(If this text disappear, that means a download session is in progress.)", label="Output")
+
+ # if platform.system() == "Windows":
+ # choose_downloader = gr.Radio(["gdown", "wget", "curl"], value="gdown", label="Download method")
+ # else:
+
+
+ with gr.Row(variant='panel', visible=False) as downbox:
+
+ if gradiostate == True:
+ with gr.Column(scale=1):
+ choose_downloader2 = gr.Radio(["gdown", "wget", "curl", "aria2"], value="gdown", label="Download method")
+ else:
+ with gr.Column(scale=1):
+ choose_downloader2 = gr.Radio(["aria2"], value="aria2", label="Downloader")
+
+
+ with gr.Row(variant='panel', visible=False) as civitbox:
+ # with gr.Box():
+ # with gr.Column(scale=1):
+ # with gr.Row():
+ civit_default2 = gr.Radio(["ckpt", "safetensors"], value="safetensors", label="CivitAI Preferred Model Type", interactive=True)
+ civit_ispruned2 = gr.Radio(["fp16", "fp32"], value="fp16", label="Model Precision", interactive=True)
+ # with gr.Row():
+ # civit_ispruned = gr.Checkbox(True, label="Pruned", interactive=True)
+ civit_alsodownvae2 = gr.Checkbox(True, label="Also Download VAE", interactive=True)
+
+ # def passvaluebetweenradio(newval):
+ # return gr.Radio.update(value=newval)
+
+ # def passvaluebetweencheckbox(newval):
+ # return gr.Checkbox.update(value=newval)
+
+ # choose_downloader2.change(passvaluebetweenradio, inputs=choose_downloader2, outputs=choose_downloader)
+ # civit_default2.change(passvaluebetweenradio, inputs=civit_default2, outputs=civit_default)
+ # civit_ispruned2.change(passvaluebetweenradio, inputs=civit_ispruned2, outputs=civit_ispruned)
+ # civit_alsodownvae2.change(passvaluebetweencheckbox, inputs=civit_alsodownvae2, outputs=civit_alsodownvae)
+
+ with gr.Row():
+ if gradiostate == True:
+ with gr.Column(scale=1, min_width=100):
+ btn_run = gr.Button("Download All!", variant="primary")
+ # btn_upload = gr.UploadButton("Upload .txt", file_types="text")
+ # btn_upload.upload(uploaded, btn_upload, file_output)
+ with gr.Column(scale=1, min_width=100):
+ btn_cancel = gr.Button("Cancel")
+ with gr.Row():
+ file_output = gr.UploadButton(file_types=['.txt'], label='Upload txt')
+ btn_pastebin = gr.Button("Copy from Pastebin")
+
+ else:
+ btn_run = gr.Button("Download All!", variant="primary")
+ btn_resume = gr.Button("Resume Download", visible=False)
+ with gr.Column(scale=1, min_width=100):
+ with gr.Row():
+ file_output = gr.UploadButton(file_types=['.txt'], label='Upload txt')
+ btn_pastebin = gr.Button("Copy from Pastebin")
+ # with gr.Column(scale=1, min_width=100):
+ # file_output = gr.UploadButton(file_types=['.txt'], label='Upload txt')
+ # copy_pastebin = gr.Button("Copy from Pastebin")
+ if gradiostate == False:
+ with gr.Row():
+ gr.Markdown(
+ f"""
+
After clicking the Download All button, it's recommended to inspect the
+ colab console, as every information about the download progress is there.
+ """)
+
+ if gradiostate == False:
+ btn_resume.click(fillbox, None, outputs=[command, out_text, btn_resume])
+
+ # file_output = gr.File(file_types=['.txt'], label="you can upload a .txt file containing links here")
+ # file_output.change(uploaded, file_output, command)
+
+ file_output.upload(uploaded, file_output, command)
+ with gr.Box(visible=True) as boxtohide:
+ with gr.Row(variant='panel'):
+ if gradiostate == True:
+ with gr.Column(scale=1):
+ choose_downloader = gr.Radio(["gdown", "wget", "curl", "aria2"], value=storedstatedownloader, label="Download method")
+ else:
+ with gr.Column(scale=1):
+ choose_downloader = gr.Radio(["aria2"], value=storedstatedownloader, label="Downloader")
+ with gr.Row(variant='panel'):
+ civit_default = gr.Radio(["ckpt", "safetensors"], value=storedstatemodeltype, label="CivitAI Preferred Model Type", interactive=True)
+ civit_ispruned = gr.Radio(["fp16", "fp32"], value=storedstateprecision, label="Model Precision", interactive=True)
+ # with gr.Row():
+ # civit_ispruned = gr.Checkbox(True, label="Pruned", interactive=True)
+ civit_alsodownvae = gr.Checkbox(storedstatevae, label="Also Download VAE", interactive=True)
+ choose_downloader.change(grchangedown, inputs=choose_downloader)
+ civit_default.change(grchangetype, inputs=civit_default)
+ civit_ispruned.change(grchangefp, inputs=civit_ispruned)
+ civit_alsodownvae.change(grchangevae, inputs=civit_alsodownvae)
+# with gr.Box(visible=True) as boxtohide:
+ # gr.Markdown("""
+ # If you feel the UI is too cramped, click the Stretch UI button above.
+ # """)
+# with gr.Accordion("List of Every Hashtags and its Path", open=False, visible=True) as rightlist:
+# righttable = gr.DataFrame(
+# buildarrayofhashtags('right'),
+# headers=["hashtag", "path"],
+# datatype=["str", "str"],
+# interactive=False
+# )
+ # sidetext = gr.Markdown(knowmoretext, visible=True)
+ def passvaluebetweenradio(newval):
+ return gr.Radio.update(value=newval)
+
+ def passvaluebetweencheckbox(newval):
+ return gr.Checkbox.update(value=newval)
+
+ choose_downloader2.change(passvaluebetweenradio, inputs=choose_downloader2, outputs=choose_downloader)
+ civit_default2.change(passvaluebetweenradio, inputs=civit_default2, outputs=civit_default)
+ civit_ispruned2.change(passvaluebetweenradio, inputs=civit_ispruned2, outputs=civit_ispruned)
+ civit_alsodownvae2.change(passvaluebetweencheckbox, inputs=civit_alsodownvae2, outputs=civit_alsodownvae)
+ finish_audio = gr.Audio(interactive=False, value=os.path.join(extension_dir, "notification.mp3"), elem_id="finish_audio", visible=False)
+ with gr.Accordion("List of Every Hashtags and its Path", open=False, visible=True) as bottomlist:
+ bottomtable = gr.DataFrame(
+ buildarrayofhashtags('bottom'),
+ headers=["hashtag", "path"],
+ datatype=["str", "str"],
+ interactive=False,
+ )
+ gr.Markdown(
+ f"""
+ Made with ❤️ by etherealxx
+ """)
+ helphider.change(hidehelp, helphider, outputs=[introduction, knowmore])
+ # uistretcher.change(stretchui, uistretcher, outputs=[boxtohide, rightlist, bottomlist])
+ # uistretcher.change(stretchui, uistretcher, outputs=boxtohide)
+ uistretcher.change(stretchui, uistretcher, outputs=[boxtohide, downbox, civitbox, choose_downloader2, civit_default2, civit_ispruned2, civit_alsodownvae2])
+ #batchlinks.load(debug, output=debug_txt, every=1)
+ if gradiostate == True:
+ run_event = btn_run.click(run, inputs=[command, choose_downloader, civit_default, civit_ispruned, civit_alsodownvae], outputs=[out_text, bottomtable]) #righttable was on output
+ btn_cancel.click(cancelrun, None, outputs=[out_text, bottomtable], cancels=[run_event])
+ else:
+ btn_run.click(run, inputs=[command, choose_downloader, civit_default, civit_ispruned, civit_alsodownvae], outputs=[out_text, bottomtable, btn_resume]) #righttable was on output
+
+ btn_pastebin.click(copyfrompastebin, inputs=[command], outputs=[command, out_text])
+
+ if sdless:
+ if platform.system() == "Windows":
+ batchlinks.queue(64).launch(inbrowser=True)
+ else:
+ batchlinks.queue(64).launch(share=True)
+ else:
+ return (batchlinks, "Batchlinks Downloader", "batchlinks"),
+if not sdless:
+ script_callbacks.on_ui_tabs(on_ui_tabs)
+else:
+ on_ui_tabs()
diff --git a/Jac12/extensions/batchlinks-webui-main/sdless-macos.sh b/Jac12/extensions/batchlinks-webui-main/sdless-macos.sh
new file mode 100644
index 0000000000000000000000000000000000000000..27ea063ed721ceb38d15841fa4a32a4ca2f6b8fe
--- /dev/null
+++ b/Jac12/extensions/batchlinks-webui-main/sdless-macos.sh
@@ -0,0 +1,8 @@
+#!/usr/bin/env bash
+pip3 show virtualenv >/dev/null || pip3 install -q virtualenv
+[ -d gradiovenv ] || virtualenv gradiovenv
+source gradiovenv/bin/activate; \
+pip3 show gradio >/dev/null || pip3 install -q gradio==3.16.2; \
+pip3 show tqdm >/dev/null || pip3 install -q tqdm
+source gradiovenv/bin/activate; \
+python3 scripts/batchlinks-downloader.py
\ No newline at end of file
diff --git a/Jac12/extensions/batchlinks-webui-main/sdless-windows-debug.bat b/Jac12/extensions/batchlinks-webui-main/sdless-windows-debug.bat
new file mode 100644
index 0000000000000000000000000000000000000000..bef02d4493ea3218dafb5ee31a91d998ec277237
--- /dev/null
+++ b/Jac12/extensions/batchlinks-webui-main/sdless-windows-debug.bat
@@ -0,0 +1,26 @@
+@echo off
+if exist gradioinstalled.bak goto beginning
+echo Checking gradio version...
+echo.
+python -c "import gradio" 2>nul && (
+ python -c "import gradio; assert gradio.__version__ == '3.16.2'" 2>nul || (
+ pip install gradio==3.16.2
+ )
+) || (
+ pip install gradio==3.16.2
+)
+pip show tqdm >nul || pip install tqdm
+pip freeze | findstr /i "\" >nul && pip freeze | findstr /i "\" >nul && (echo. > gradioinstalled.bak)
+echo.
+
+:beginning
+cd scripts
+echo ^> python -m batchlinks-downloader.py --debug
+echo.
+python -m batchlinks-downloader.py --debug
+echo.
+echo Close the terminal to stop the looping launch
+echo.
+pause
+echo.
+goto beginning
\ No newline at end of file
diff --git a/Jac12/extensions/batchlinks-webui-main/sdless-windows.bat b/Jac12/extensions/batchlinks-webui-main/sdless-windows.bat
new file mode 100644
index 0000000000000000000000000000000000000000..565d387d9b2b1069e3907b3df77231fc8655d529
--- /dev/null
+++ b/Jac12/extensions/batchlinks-webui-main/sdless-windows.bat
@@ -0,0 +1,26 @@
+@echo off
+if exist gradioinstalled.bak goto beginning
+echo Checking gradio version...
+echo.
+python -c "import gradio" 2>nul && (
+ python -c "import gradio; assert gradio.__version__ == '3.16.2'" 2>nul || (
+ pip install gradio==3.16.2
+ )
+) || (
+ pip install gradio==3.16.2
+)
+pip show tqdm >nul || pip install tqdm
+pip freeze | findstr /i "\" >nul && pip freeze | findstr /i "\" >nul && (echo. > gradioinstalled.bak)
+echo.
+
+:beginning
+cd scripts
+echo ^> python -m batchlinks-downloader.py
+echo.
+python -m batchlinks-downloader.py
+echo.
+echo Close the terminal to stop the looping launch
+echo.
+pause
+echo.
+goto beginning
\ No newline at end of file
diff --git a/Jac12/extensions/batchlinks-webui-main/version.txt b/Jac12/extensions/batchlinks-webui-main/version.txt
new file mode 100644
index 0000000000000000000000000000000000000000..32797671a624be9819257a3bc1d12aaf10baf389
--- /dev/null
+++ b/Jac12/extensions/batchlinks-webui-main/version.txt
@@ -0,0 +1,136 @@
+v3.2.1
+(^current version, hopefully not the last^)
+
+Release notes:
+
+## v3.2.1
+- Changed "pruned" option to "fp precision" due to CivitAI API changes
+- Fixed bug: No matter when the download process is cancelled or not, CivitAI download will give print out notification that the download process is successful
+- Fixed bug: Preventing the UI errored out when storage is full and trying to convert jpg image while downloading civitai stuff (PIL.UnidentifiedImageError)
+- UI overhaul
+
+## v3.2.0a
+- Added support for vladmandic's fork of automatic1111's webui
+
+## v3.2.0
+- Bug fixed when downloading with aria2 on Windows
+- Bug fixed on gradio update checker on sdless batch file for windows
+- CivitAi error prevention (when the website is down)
+- Cleaned the code of the hashtag system
+- `Copy from Pastebin` feature
+- Custom aria command with `@aria`
+- Making sure custom hashtag doesn't start with number
+- New calmer notification sound
+- Readme page cleanup
+- Some help link changed to link into wiki instead
+- UI fix to adapt with latest gradio (v3.23.0)
+- Various bug fixes related to CivitAI download
+
+## v3.1.1b
+- Hotfix: Fixed CivitAI link refuses to be downloaded properly. Seems like CivitAI changes its API.
+- Fixed several bugs on Windows, especially SDless
+
+## v3.1.1a
+- Hotfix: Fixed CivitAI 'model type chooser' bug and fixed `@extract` bug on colab
+
+## v3.1.1
+- Added some fix and messages in case CivitAI website is down
+- Added message when user pressed "Download All!" but the textbox is empty
+- Fixed bug where Lycoris folder always shows on downloaded files the first time user download something
+
+## v3.1.0a
+- Hotfix: Indented block on line 1497 fix
+
+## v3.1.0
+- New hashtag: `#altmodel`, when you use `--ckptdir` argument on `launch.py` line, this hashtag will points to that directory. Otherwise, it'll point to the same directory as `#model`
+- New hashtag: `#lycoris`, change current save directory to _/content/stable-diffusion-webui/extensions/sd-webui-additional-networks/models/lora/lycoris_
(Side note: _Lycoris/Locon/Loha_ will works just fine if you use `#addnetlora` instead, as long as you have both [addnet extension](https://github.com/kohya-ss/sd-webui-additional-networks) and [locon extension](https://github.com/KohakuBlueleaf/a1111-sd-webui-locon) installed)
+- New hashtag: `#upscaler`, change current save directory to _/content/stable-diffusion-webui/models/ESRGAN_ (This was added few commits ago, but i forgot to write it on the release notes)
+
+Fixes:
+- Fixed bug when installing wget/aria2 on Windows
+- Fixed bug where custom paths doesn't put CivitAi download (Model Path method) when custom hashtag is used
+- Ongoing downloads will correctly stops when Cancel button is pressed on Windows
+- CivitAi (Model Path method) now will not download training dataset by accident
+
+## v3.0.2
+- Hotfix: removed a comment that messed up the non queue mode. Now the extension works again without `--gradio-queue`.
+
+## v3.0.1
+- Hotfix: using `urllib.request` instead of `curl -sI` to get the model name on CivitAI direct link method, since it's more reliable (and the curl method always fails somehow). The `requests` method is returned as a fallback.
+
+## v3.0.0
+- Added `@extract` syntax
+- Supports for custom hashtags with `@new` syntax
+- (Almost) Full Windows support
+- Auto-download config file if available when downloading from CivitAI (SD 2.0+)
+- Auto-renaming for downloading ckpt/safetensors and pruned model from CivitAI using direct link method
+- CivitAI direct link now use `curl` to get the filename, and use the chosen download method (from the four) to download. Huge download speed boost. `requests` is no longer needed.
+- Supports download from Anonfiles, Dropbox, Google Drive, Mediafire, Pixeldrain
+- Supports download from Github (raw and release files)
+- Supports for SDless mode (read more [here](https://github.com/etherealxx/batchlinks-webui#sdless-mode))
+- UI overhaul:
+ - Now there's a table that shows where does the hashtags points into
+ - Option to stretch the UI, if your monitor is small, or using colab on mobile
+ - Option to hide help text
+ - Option to choose preferred CivitAI models. This will works if you download the model via model page link (https://civitai.com/models/)
+ - Upload txt now use a little button instead of covering half of the screen
+
+Fixes:
+- CivitAI `model page link` no longer randomly download the first model on the json list.
+- Most of Windows bugs
+- Renaming problem when using CivitAI model page link method
+- Warning message when CivitAI download isn't possible (server down)
+
+## v2.1.2
+- CivitAI direct link now use curl to get the filename, and use the chosen download method to download. Requests is no longer needed.
+
+## v2.1.1
+- Partial Windows support is back
+
+Changes:
+- wget disabled on windows currently, until it fixed
+
+Fixes:
+- gdown & curl bug fixed
+- utf-8 as default encoding for queue checker (fix bug in Windows)
+
+## v2.1.0
+Features:
+- Supports renaming downloaded file with `>` (for example: `https://files.catbox.moe/uarze8.safetensors > neurosama.safetensors`)
+- Supports extension usage without `--gradio-queue` (ported from [onedotsix](https://github.com/etherealxx/batchlinks-webui/tree/onedotsix))
+- Supports running shell command from the UI with `!` (for example: type `!pip freeze`, then hit the `Download all!` button and see the colab console)
+- Progress bar for `--gradio-queue`
+
+Changes:
+- `aria2` as *the only* download method when using without `--gradio-queue`
+- Download session will be cut every 80 seconds on when using without `--gradio-queue` (just like [onedotsix](https://github.com/etherealxx/batchlinks-webui/tree/onedotsix))
+- _Debug stopwatch (decorator)_ won't run automatically when `globaldebug = True`, must be uncommented manually (it disrupt the progress bar)
+- Dropped support for webui based on Gradio 3.9 (update your installation, or use [onedotsix](https://github.com/etherealxx/batchlinks-webui/tree/onedotsix) instead)
+- UI tweak (Smaller font size)
+
+## v2.0.0
+Features:
+- `aria2` as download method.
+- Cancel button for cancelling download process (`--gradio-queue` required)
+- Debug snapshot.
+When `global_debug = True`, the moment this extension launch, it saves the current state of the webui on various location (into `snapshot.txt`), and when you type `#debugresetdownloads` on the textbox, it will compare the current state and the last saved state, and removes every new file/folder. This will be useful for debugging and testing.
+- Debug every download method.
+When `global_debug = True` and you type `#debugevery method` on the textbox, every link that has 4 different method of download (Huggingface etc.) will be downloaded with every method, regardless of the radio button choice. The result is 4 file being downloaded.
+- Detection if a CivitAI links no longer exist
+- New hashtags: `#textualinversion`, `#ti`, `#aestheticembedding`, `#aestheticembed`, `#controlnet`, and `#cnet`
+- Toggle logging on/off
+- `shlex.quote` to properly quote links (Thanks **[@rti7743](https://github.com/rti7743)**!)
+- Supports cloning webui extensions
+- Supports download from CivitAI model links (Thanks **[@rti7743](https://github.com/rti7743)**!)
+- Supports download from Github (repository and raw files)
+- Supports for aesthetic gradients, controlnet model, and extensions path.
+- UI font scaled down
+- Uses `subprocess.Popen` instead of `os.system`
+
+
+Older releases:
+
+- commit "alpha" is v0.1.0 (09b1d81806e5bfc4d1783ccf644359fabc372fb7)
+- commit "Civit support, i hope it works." is v0.2.0 (2420ea4dd670ec71481a2ed43ff22c7c1a959543)
+- commit "🪲Bug fix and 🖼️stuff" is v0.2.1 (c7a91b6e14ca6f35438e29ab7ad3d2e00d62c99b)
+- commit "Merge pull request #1 from etherealxx/gradioevery" is v1.0.0 (a89e50fdfb5008f703750cf0e7878fc6c25f9219)