From 7f5707c0e1a6b78bb643dd5018873e6a70801dfe Mon Sep 17 00:00:00 2001 From: butaixianran Date: Sat, 13 Jan 2024 22:50:46 +0800 Subject: [PATCH] ignore video preview --- README.md | 3 +++ scripts/ch_lib/civitai.py | 5 +++++ scripts/ch_lib/util.py | 2 +- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index d784768..5e90816 100644 --- a/README.md +++ b/README.md @@ -226,6 +226,9 @@ Since v1.5.5, we've already optimized the SHA256 function to the top. So the onl # Change Log +## v1.9.1 +* Ignore video preview from civitai + ## v1.9.0 * support civitai API key for downloading. Check document for detail diff --git a/scripts/ch_lib/civitai.py b/scripts/ch_lib/civitai.py index 0efd71b..5f57947 100644 --- a/scripts/ch_lib/civitai.py +++ b/scripts/ch_lib/civitai.py @@ -347,6 +347,11 @@ def get_preview_image_by_model_path(model_path:str, max_size_preview, skip_nsfw_ if skip_nsfw_preview: util.printD("Skip NSFW image") continue + + preview_type = img_dict.get("type") + if preview_type != "image": + util.printD(f"Unsupported preview type: {preview_type}, ignore.") + continue if "url" in img_dict.keys(): img_url = img_dict["url"] diff --git a/scripts/ch_lib/util.py b/scripts/ch_lib/util.py index f2f3011..75c23bf 100644 --- a/scripts/ch_lib/util.py +++ b/scripts/ch_lib/util.py @@ -6,7 +6,7 @@ import requests import shutil -version = "1.9.0" +version = "1.9.1" def_headers = {'User-Agent': 'Mozilla/5.0 (iPad; CPU OS 12_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148', "Authorization": ""}