From 2ac0d46935eacca85f6763cd90fe662820bf8b3f Mon Sep 17 00:00:00 2001 From: silveroxides Date: Wed, 8 Apr 2026 15:43:05 +0200 Subject: [PATCH] Add progress bar --- nodes/downloader_utils.py | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/nodes/downloader_utils.py b/nodes/downloader_utils.py index 7694525..1793a54 100644 --- a/nodes/downloader_utils.py +++ b/nodes/downloader_utils.py @@ -562,11 +562,26 @@ def scan_and_process(scan_dirs, recursive=True, db_path=None, nsfw_level="All", print(f"Found {len(files_to_process)} models to process.") + # Import and use ComfyUI's ProgressBar + try: + import comfy.utils + pbar = comfy.utils.ProgressBar(len(files_to_process)) + except ImportError: + pbar = None + if threads > 1: print(f"Starting {threads} threads...") with concurrent.futures.ThreadPoolExecutor(max_workers=threads) as executor: futures = [executor.submit(process_file, fp, cache, api, nsfw_threshold, max_examples) for fp in files_to_process] - concurrent.futures.wait(futures) + for future in concurrent.futures.as_completed(futures): + try: + future.result() + except Exception as e: + print(f"Error in thread: {e}") + if pbar: + pbar.update(1) else: for filepath in files_to_process: process_file(filepath, cache, api, nsfw_threshold, max_examples) + if pbar: + pbar.update(1)