From 79c554f0359c044fa955fe769e3c94c62777a462 Mon Sep 17 00:00:00 2001 From: MeeeyoAI Date: Wed, 26 Feb 2025 22:00:38 +0800 Subject: [PATCH] Update --- __init__.py | 13 +++++++- meyo_node_Functional.py | 68 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 80 insertions(+), 1 deletion(-) create mode 100644 meyo_node_Functional.py diff --git a/__init__.py b/__init__.py index 809db54..8d4943b 100644 --- a/__init__.py +++ b/__init__.py @@ -1,6 +1,7 @@ from .meyo_node_Computational import StandardSize, CompareInt, FloatToInteger, GenerateNumbers, GetRandomIntegerInRange from .meyo_node_String import AddPrefixSuffix, ExtractSubstring, ExtractSubstringByIndices, SplitStringByDelimiter, ProcessString, ExtractBeforeAfter, ReplaceNthOccurrence, BatchReplaceStrings, ReplaceMultiple, RandomLineFromText, CheckSubstringPresence, AddPrefixSuffixToLines, ExtractAndCombineLines, FilterLinesBySubstrings, FilterLinesByWordCount, SplitAndExtractText, CountOccurrences, ExtractLinesByIndex, ExtractSpecificLines, RemoveContentBetweenChars, ShuffleTextLines, ConditionalTextOutput, TextConditionCheck, TextConcatenation, ExtractSpecificData, FindFirstLineContent from .meyo_node_File import FileListAndSuffix, ReadExcelData, WriteExcelData, FindExcelData, ReadExcelRowOrColumnDiff +from .meyo_node_Functional import GetCurrentTime, SelectionParameter NODE_CLASS_MAPPINGS = { @@ -47,6 +48,10 @@ NODE_CLASS_MAPPINGS = { "FindExcelData": FindExcelData, "ReadExcelRowOrColumnDiff": ReadExcelRowOrColumnDiff, + #功能型节点:meyo_node_Functional + "GetCurrentTime": GetCurrentTime, + "SelectionParameter": SelectionParameter, + } @@ -93,5 +98,11 @@ NODE_DISPLAY_NAME_MAPPINGS = { "WriteExcelData": "写入表格数据(meeeyo.com)", "FindExcelData": "查找表格数据(meeeyo.com)", "ReadExcelRowOrColumnDiff": "读取表格数量差(meeeyo.com)", + + #功能型节点:meyo_node_Functional + "GetCurrentTime": "当前时间", + "SelectionParameter": "选择参数", + +} + -} \ No newline at end of file diff --git a/meyo_node_Functional.py b/meyo_node_Functional.py new file mode 100644 index 0000000..f26f08e --- /dev/null +++ b/meyo_node_Functional.py @@ -0,0 +1,68 @@ +from datetime import datetime +import ntplib + +#======获取当前时间 +class GetCurrentTime: + def __init__(self): + pass + + @classmethod + def INPUT_TYPES(cls): + return { + "required": { + "prefix": ("STRING", {"default": ""}), # Input field for the prefix + }, + "optional": { + "any": ("*",), # Accept any type of input as optional + }, + } + + RETURN_TYPES = ("STRING",) + FUNCTION = "get_current_time" + CATEGORY = "Meeeyo/Functional" + + def IS_CHANGED(): + return float("NaN") + + def get_current_time(self, prefix="", any=None): + # Get the current system time + current_time = datetime.now() + # Format the time as a string + formatted_time = current_time.strftime("%Y-%m-%d %H:%M:%S") + # Include the prefix in the output + result = f"{prefix}{formatted_time}" + # Return the formatted time with prefix as a string + return (result,) + + +#======选择性别和模板 +class SelectionParameter: + def __init__(self): + pass + + @classmethod + def INPUT_TYPES(cls): + return { + "required": { + "gender": (["男性", "女性"], {"default": "男性"}), + "version": (["竖版", "横版"], {"default": "竖版"}), + "additional_text": ("STRING", {"multiline": True, "default": "附加的多行文本内容"}), + }, + "optional": {}, + } + + RETURN_TYPES = ("STRING",) + FUNCTION = "gender_output" + CATEGORY = "Meeeyo/Functional" + + def gender_output(self, gender, version, additional_text): + # 根据选择的性别返回相应的值 + gender_value = 1 if gender == "男性" else 2 + version_value = 1 if version == "竖版" else 2 + + # 组合成最终的输出格式 "1+1" 或 "1+2" 或 "2+1" 或 "2+2" + result = f"{gender_value}+{version_value}" + + # 将生成的整数组合与多行文本内容合并输出 + combined_result = f"{result}\n\n{additional_text.strip()}" + return (combined_result,) \ No newline at end of file