From 953f24a1d4a653936f360d865e85c6c0f1201845 Mon Sep 17 00:00:00 2001 From: corkborg <62742115+corkborg@users.noreply.github.com> Date: Wed, 11 Oct 2023 17:45:20 +0900 Subject: [PATCH] =?UTF-8?q?=E7=94=BB=E5=83=8F=E3=83=95=E3=82=A1=E3=82=A4?= =?UTF-8?q?=E3=83=AB=E3=81=A0=E3=81=91=E3=82=92=E5=87=A6=E7=90=86.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- run.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/run.py b/run.py index f8d1564..d61c8cb 100644 --- a/run.py +++ b/run.py @@ -43,14 +43,18 @@ def image_interrogate(image_path: Path): if args.dir: d = Path(args.dir) for f in d.iterdir(): - tags = image_interrogate(Path(f)) - + if not f.is_file() or f.suffix not in ['.png', '.jpg', '.webp']: + continue + image_path = Path(f) + print('processing:', image_path) + tags = image_interrogate(image_path) tags_str = ", ".join(tags.keys()) with open(f.parent / f"{f.stem}{args.ext}", "w") as fp: fp.write(tags_str) if args.file: tags = image_interrogate(Path(args.file)) + print() tags_str = ", ".join(tags.keys()) print(tags_str)