Compare commits

...

3 Commits

Author SHA1 Message Date
ZiYu
7f2f85c86b
Merge e7d4ea76d7 into 4941fb8aa0 2025-11-26 14:59:38 +08:00
Dr.Lt.Data
4941fb8aa0 fixed: scanner.py
Some checks are pending
Python Linting / Run Ruff (push) Waiting to run
2025-11-26 08:58:02 +09:00
ZiYu
e7d4ea76d7
Add ComfyUI-ZiYu_LabelKit node
### Description
Added a new custom node package: **ComfyUI-ZiYu_LabelKit**.

This node allows users to batch-load images from a directory while automatically retrieving their filenames.  
It helps streamline labeling and dataset preparation workflows by outputting both image data and structured file information.

### Details
- Supports batch image loading (.jpg, .png, .webp, .jxl)
- Extracts filenames and file paths simultaneously
- Provides outputs for images, masks, filenames, paths, and count
- Designed to accelerate data labeling and preprocessing tasks

### Version
v1.0.0 — Initial release
2025-10-20 00:38:14 +08:00
2 changed files with 21 additions and 3 deletions

View File

@ -694,5 +694,15 @@
"install_type": "git-clone",
"description": "View Image Metadata of ComfyUI as well as of ForgeUI or Automatic 1111 generated images in Easily Readable Format"
}
{
"author": "DNPMBHC",
"title": "ComfyUI-ZiYu_LabelKit",
"reference": "https://github.com/DNPMBHC/ComfyUI-ZiYu_LabelKit",
"files": [
"https://github.com/DNPMBHC/ComfyUI-ZiYu_LabelKit"
],
"install_type": "git-clone",
"description": "A lightweight ComfyUI custom node that batch-loads images and extracts filenames simultaneously to accelerate labeling workflows."
}
]
}

View File

@ -105,10 +105,17 @@ def extract_nodes(code_text):
warnings.filterwarnings('ignore', category=DeprecationWarning)
parsed_code = ast.parse(code_text)
assignments = (node for node in parsed_code.body if isinstance(node, ast.Assign))
# Support both ast.Assign and ast.AnnAssign (for type-annotated assignments)
assignments = (node for node in parsed_code.body if isinstance(node, (ast.Assign, ast.AnnAssign)))
for assignment in assignments:
if isinstance(assignment.targets[0], ast.Name) and assignment.targets[0].id in ['NODE_CONFIG', 'NODE_CLASS_MAPPINGS']:
# Handle ast.AnnAssign (e.g., NODE_CLASS_MAPPINGS: Type = {...})
if isinstance(assignment, ast.AnnAssign):
if isinstance(assignment.target, ast.Name) and assignment.target.id in ['NODE_CONFIG', 'NODE_CLASS_MAPPINGS']:
node_class_mappings = assignment.value
break
# Handle ast.Assign (e.g., NODE_CLASS_MAPPINGS = {...})
elif isinstance(assignment.targets[0], ast.Name) and assignment.targets[0].id in ['NODE_CONFIG', 'NODE_CLASS_MAPPINGS']:
node_class_mappings = assignment.value
break
else:
@ -228,7 +235,8 @@ def scan_in_file(filename, is_builtin=False):
with open(filename, encoding='utf-8', errors='ignore') as file:
code = file.read()
pattern = r"_CLASS_MAPPINGS\s*=\s*{([^}]*)}"
# Support type annotations (e.g., NODE_CLASS_MAPPINGS: Type = {...}) and line continuations (\)
pattern = r"_CLASS_MAPPINGS\s*(?::\s*\w+\s*)?=\s*(?:\\\s*)?{([^}]*)}"
regex = re.compile(pattern, re.MULTILINE | re.DOTALL)
nodes = set()