diff --git a/__init__.py b/__init__.py index 183f413..7cfb11f 100644 --- a/__init__.py +++ b/__init__.py @@ -18,6 +18,11 @@ from .src.comfyui_ino_nodes.node_bedrive_getparentid import BeDriveGetParentID from .src.comfyui_ino_nodes.node_utils import InoParseFilePath from .src.comfyui_ino_nodes.node_utils import InoNotBoolean from .src.comfyui_ino_nodes.node_utils import InoCountFiles +from .src.comfyui_ino_nodes.node_utils import InoIntEqual +from .src.comfyui_ino_nodes.node_utils import InoBranchImage +from .src.comfyui_ino_nodes.node_utils import InoDateTimeAsString + +from .src.comfyui_ino_nodes.node_video_convert import InoVideoConvert NODE_CLASS_MAPPINGS = { @@ -28,6 +33,11 @@ NODE_CLASS_MAPPINGS = { "Ino_ParseFilePath": InoParseFilePath, "Ino_NotBoolean": InoNotBoolean, "Ino_CountFiles": InoCountFiles, + "Ino_IntEqual": InoIntEqual, + "Ino_BranchImage": InoBranchImage, + "Ino_DateTimeAsString": InoDateTimeAsString, + + "Ino_VideoConvert": InoVideoConvert, } @@ -39,6 +49,11 @@ NODE_DISPLAY_NAME_MAPPINGS = { "Ino_ParseFilePath": "Ino Parse File Path", "Ino_NotBoolean": "Ino Not Boolean", "Ino_CountFiles": "Ino Count Files", + "Ino_IntEqual": "Ino Int Equal", + "Ino_BranchImage": "Ino Branch Image", + "Ino_DateTimeAsString": "Ino DateTime As String", + + "Ino_VideoConvert": "Ino Video Convert", } diff --git a/src/comfyui_ino_nodes/node_utils.py b/src/comfyui_ino_nodes/node_utils.py index ca70e63..2dfaa46 100644 --- a/src/comfyui_ino_nodes/node_utils.py +++ b/src/comfyui_ino_nodes/node_utils.py @@ -2,7 +2,9 @@ from inspect import cleandoc import os import fnmatch +from datetime import datetime +#---------------------------------InoParseFilePath class InoParseFilePath: """ return path, name, extension from full file path @@ -46,6 +48,7 @@ class InoParseFilePath: +#---------------------------------InoNotBoolean class InoNotBoolean: """ reverse boolean @@ -74,6 +77,10 @@ class InoNotBoolean: return (not boolean, ) + + + +#---------------------------------InoCountFiles class InoCountFiles: """ count files in folder @@ -135,3 +142,162 @@ class InoCountFiles: final_matches = name_matches return (len(final_matches),) + + + + + + +#---------------------------------InoIntEqual +class InoIntEqual: + """ + check if its equal to the input Int + """ + + @classmethod + def INPUT_TYPES(s): + return { + "required": { + "int_a": ("INT", { + "default": 0, + "step": 1, + "display": "number" + }), + "int_b": ("INT", { + "default": 0, + "step": 1, + "display": "number" + }), + }, + + } + + RETURN_TYPES = ("BOOLEAN", ) + RETURN_NAMES = ("is equal", ) + DESCRIPTION = cleandoc(__doc__) + FUNCTION = "function" + + CATEGORY = "InoNodes" + + def __init__(self): + pass + + + def function(self, int_a, int_b): + return (int_a == int_b, ) + + + + + +#---------------------------------InoImageBranch +class InoBranchImage: + """ + + """ + + @classmethod + def INPUT_TYPES(s): + return { + "required": { + "boolean": ("BOOLEAN", {"default": True}), + }, + "optional": { + "input_image": ("IMAGE", ), + }, + } + + RETURN_TYPES = ("IMAGE", ) + RETURN_NAMES = ("output_image", ) + DESCRIPTION = cleandoc(__doc__) + FUNCTION = "function" + + CATEGORY = "InoNodes" + + def __init__(self): + pass + + + def function(self, boolean, input_image=None): + if boolean: + return (input_image, ) + else: + return (input_image, ) + + + +#---------------------------------InoImageBranch +class InoDateTimeAsString: + """ + Date Time As String + """ + + @classmethod + def INPUT_TYPES(s): + return { + "required": { + "include_year": ("BOOLEAN", {"default": True, "label_off": "Exclude", "label_on": "Include"}), + "include_month": ("BOOLEAN", {"default": True, "label_off": "Exclude", "label_on": "Include"}), + "include_day": ("BOOLEAN", {"default": True, "label_off": "Exclude", "label_on": "Include"}), + "include_hour": ("BOOLEAN", {"default": True, "label_off": "Exclude", "label_on": "Include"}), + "include_minute": ("BOOLEAN", {"default": True, "label_off": "Exclude", "label_on": "Include"}), + "include_second": ("BOOLEAN", {"default": True, "label_off": "Exclude", "label_on": "Include"}), + "date_sep": ("STRING", { + "multiline": False, + "default": "-" + }), + "datetime_sep": ("STRING", { + "multiline": False, + "default": "-" + }), + "time_sep": ("STRING", { + "multiline": False, + "default": "-" + }), + }, + } + + RETURN_TYPES = ("STRING", ) + RETURN_NAMES = ("output_date_time", ) + DESCRIPTION = cleandoc(__doc__) + FUNCTION = "function" + + CATEGORY = "InoNodes" + + def __init__(self): + pass + + + def function(self, include_year, include_month, include_day, + include_hour, include_minute, include_second, + date_sep="-", datetime_sep=" ", time_sep=":"): + now = datetime.now() + + date_parts = [] + time_parts = [] + + if include_year: + date_parts.append(str(now.year)) + if include_month: + date_parts.append(f"{now.month:02d}") + if include_day: + date_parts.append(f"{now.day:02d}") + + if include_hour: + time_parts.append(f"{now.hour:02d}") + if include_minute: + time_parts.append(f"{now.minute:02d}") + if include_second: + time_parts.append(f"{now.second:02d}") + + date_str = date_sep.join(date_parts) if date_parts else "" + time_str = time_sep.join(time_parts) if time_parts else "" + + if date_str and time_str: + return (f"{date_str}{datetime_sep}{time_str}", ) + elif date_str: + return (date_str, ) + elif time_str: + return (time_str, ) + else: + return ("", )