diff --git a/__init__.py b/__init__.py index af5808d..cfc2ba0 100644 --- a/__init__.py +++ b/__init__.py @@ -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") diff --git a/file_list_to_path.py b/file_list_to_path.py new file mode 100644 index 0000000..11f9fd6 --- /dev/null +++ b/file_list_to_path.py @@ -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", +}