BlafKing / sd-civitai-browser-plus

Extension to access CivitAI via WebUI: download, delete, scan for updates, list installed models, assign tags, and boost downloads with multi-threading.
GNU Affero General Public License v3.0
309 stars 53 forks source link

[Bug]: Downloading all html despite unchecked #293

Closed silveroxides closed 4 months ago

silveroxides commented 4 months ago

Describe the bug.

The extension updates html of each model while "Overwrite any existing files. (previews, HTMLs, tags, descriptions)" is checked even if "Save HTML file for each model when updating info & tags (increases process time)." is unchecked. If the mentioned issue is working as intended then the should be "increses process time" warning there too or at least and indicator that it enabled all html download.

sEZxnAU2iK

Can't say I was happy to see 1631 files being processed and since the extension chooses to display each file gone through as a progress update in gradio the entire browser is having staggering issues. It peaked at around 420 at which the tab crashed. You can see by my system specs that it is not a slow PC. Maybe consider if your code might need some optimization

msedge_5Af0gCqpag

Steps to reproduce the problem.

Go to Update Models. Repeat the actions I described.

Expected behavior

Not to Download 1631 html unless "Save HTML file for each model when updating info & tags (increases process time)." is checked while "Overwrite any existing files. (previews, HTMLs, tags, descriptions)" is checked.

System info

Console logs

Only thing there is:

CivitAI Browser+: HTML saved at "C:\Stable_Diffusion\stable-diffusion-webui\models\Lora\subdir\LoRAname.html"
CivitAI Browser+: Model info saved to "C:\Stable_Diffusion\stable-diffusion-webui\models\Lora\subdir\LoRAname.json"

Additional information

No response

BlafKing commented 4 months ago

Thanks for pointing out the issue, after a quick skim it looks like the issue is caused by a little oversight, there is a condition where it states

if create_html and not os.path.exists(html_path) or overwrite_toggle

So it looks like it currently generates a new HTML file when the overwrite toggle is on regardless of other options. Will include a fix for this in the next update when I finally have some time to write new changes :,) šŸ‘šŸ»

About your comment stating that the code is unoptimized, it most definitely is and that's not gonna change anytime soon. I'm not by any means experienced when it comes to python code nor the inner working of the Gradio UI library. This is, after all, a solo project I made in my free time with little to no experience. (And not a paid program where you can expect quality)

BlafKing commented 4 months ago

Made a small hotfix to the line which should hopefully resolve your issues, can't test the code right now as I won't be home for a while/won't be able to run SD-Webui for a while, so let me know it has fixed the issue šŸ‘šŸ»

silveroxides commented 4 months ago

Working as intended now. 186 models took ~6 seconds post API call to update info and tags for which is a huge improvement.