Add File List to File Path converter node
This commit is contained in:
@@ -94,6 +94,7 @@ _safe_merge("file_list_loader")
|
||||
_safe_merge("mp3_audio_loader")
|
||||
_safe_merge("mp3_embed_image")
|
||||
|
||||
_safe_merge("file_list_to_path")
|
||||
_safe_merge("adaptive_resolution")
|
||||
|
||||
_safe_merge("colab_nodes")
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
class FileListToFilePath:
|
||||
"""
|
||||
Convert file list (xử lí cùng lúc) to file path (xử lí từng file).
|
||||
Giống Image List to Image Batch nhưng cho file paths.
|
||||
"""
|
||||
|
||||
@classmethod
|
||||
def INPUT_TYPES(cls):
|
||||
return {
|
||||
"required": {
|
||||
"file_paths": ("STRING",),
|
||||
}
|
||||
}
|
||||
|
||||
INPUT_IS_LIST = True
|
||||
RETURN_TYPES = ("STRING", "INT")
|
||||
RETURN_NAMES = ("file_path", "count")
|
||||
OUTPUT_IS_LIST = (True, False)
|
||||
FUNCTION = "convert"
|
||||
CATEGORY = "comfyui-sortlist"
|
||||
|
||||
def convert(self, file_paths):
|
||||
# Filter out empty strings
|
||||
paths = [p for p in file_paths if p and p.strip()]
|
||||
return (paths, len(paths))
|
||||
|
||||
|
||||
NODE_CLASS_MAPPINGS = {
|
||||
"File List To File Path": FileListToFilePath,
|
||||
}
|
||||
|
||||
NODE_DISPLAY_NAME_MAPPINGS = {
|
||||
"File List To File Path": "File List to File Path",
|
||||
}
|
||||
Reference in New Issue
Block a user