Update
This commit is contained in:
@@ -15,7 +15,7 @@ Accurately extracts specified content from text using positional indexing and ke
|
||||
- **Integration with Excel:**
|
||||
Achieves deep integration with Excel, supporting read and write operations on paged and tabular data, facilitating batch completion of complex tasks and significantly improving efficiency.
|
||||
|
||||
## Update Notes (2025-04-13):
|
||||
## Update Notes (2025-04-21):
|
||||
1.Added LoadAndAdjustImage node to load and resize images.
|
||||
|
||||
2.Added SaveImagEX node to save images to a specified directory (also added an image output port).
|
||||
|
||||
+13
-15
@@ -1,7 +1,7 @@
|
||||
from .meyo_node_Computational import CompareInt, FloatToInteger, GenerateNumbers, GetRandomIntegerInRange
|
||||
from .meyo_node_String import SingleTextInput, MultiParamInputNode, 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 LoadAndAdjustImage, ImageAdjuster, SaveImagEX, FileCopyCutNode, ReadWebNode, FileListAndSuffix, ReadExcelData, WriteExcelData, FindExcelData, ReadExcelRowOrColumnDiff
|
||||
from .meyo_node_Functional import GetCurrentTime, SelectionParameter
|
||||
from .meyo_node_Computational import *
|
||||
from .meyo_node_String import *
|
||||
from .meyo_node_File import *
|
||||
from .meyo_node_Functional import *
|
||||
|
||||
|
||||
NODE_CLASS_MAPPINGS = {
|
||||
@@ -11,6 +11,7 @@ NODE_CLASS_MAPPINGS = {
|
||||
"FloatToInteger": FloatToInteger,
|
||||
"GenerateNumbers": GenerateNumbers,
|
||||
"GetRandomIntegerInRange": GetRandomIntegerInRange,
|
||||
|
||||
|
||||
#字符串处理:meyo_node_String
|
||||
"SingleTextInput": SingleTextInput,
|
||||
@@ -45,11 +46,10 @@ NODE_CLASS_MAPPINGS = {
|
||||
#文件处理:meyo_node_File
|
||||
"LoadAndAdjustImage": LoadAndAdjustImage,
|
||||
"ImageAdjuster": ImageAdjuster,
|
||||
"SaveImagEX": SaveImagEX,
|
||||
"FileCopyCutNode": FileCopyCutNode,
|
||||
|
||||
"ReadWebNode": ReadWebNode,
|
||||
"CustomCrop": CustomCrop,
|
||||
|
||||
"SaveImagEX": SaveImagEX,
|
||||
"FileCopyCutNode": FileCopyCutNode,
|
||||
"FileListAndSuffix": FileListAndSuffix,
|
||||
"ReadExcelData": ReadExcelData,
|
||||
"WriteExcelData": WriteExcelData,
|
||||
@@ -59,7 +59,7 @@ NODE_CLASS_MAPPINGS = {
|
||||
#功能型节点:meyo_node_Functional
|
||||
"GetCurrentTime": GetCurrentTime,
|
||||
"SelectionParameter": SelectionParameter,
|
||||
|
||||
"ReadWebNode": ReadWebNode,
|
||||
}
|
||||
|
||||
|
||||
@@ -104,11 +104,9 @@ NODE_DISPLAY_NAME_MAPPINGS = {
|
||||
#文件处理:meyo_node_File
|
||||
"LoadAndAdjustImage": "加载重置图像(meeeyo.com)",
|
||||
"ImageAdjuster": "重置图像(meeeyo.com)",
|
||||
"CustomCrop": "裁剪图像(meeeyo.com)",
|
||||
|
||||
"SaveImagEX": "保存图像(meeeyo.com)",
|
||||
|
||||
"ReadWebNode": "读取页面(meeeyo.com)",
|
||||
|
||||
|
||||
"FileCopyCutNode": "文件操作(meeeyo.com)",
|
||||
"FileListAndSuffix": "从路径加载(meeeyo.com)",
|
||||
"ReadExcelData": "读取表格数据(meeeyo.com)",
|
||||
@@ -118,8 +116,8 @@ NODE_DISPLAY_NAME_MAPPINGS = {
|
||||
|
||||
#功能型节点:meyo_node_Functional
|
||||
"GetCurrentTime": "当前时间(戳)",
|
||||
"SelectionParameter": "选择参数",
|
||||
|
||||
"SelectionParameter": "选择参数(meeeyo.com)",
|
||||
"ReadWebNode": "读取页面(meeeyo.com)",
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import math
|
||||
import random
|
||||
|
||||
import torch
|
||||
import numpy as np
|
||||
|
||||
#======比较数值
|
||||
class CompareInt:
|
||||
@@ -20,7 +21,8 @@ class CompareInt:
|
||||
RETURN_TYPES = ("STRING",)
|
||||
FUNCTION = "compare_float_to_range"
|
||||
CATEGORY = "Meeeyo/Number"
|
||||
|
||||
DESCRIPTION = "如需更多帮助或商务需求(For tech and business support)+VX/WeChat: meeeyo"
|
||||
|
||||
def compare_float_to_range(self, input_float, range):
|
||||
try:
|
||||
if '-' in range:
|
||||
@@ -54,7 +56,8 @@ class FloatToInteger:
|
||||
RETURN_TYPES = ("INT",)
|
||||
FUNCTION = "convert_float_to_integer"
|
||||
CATEGORY = "Meeeyo/Number"
|
||||
|
||||
DESCRIPTION = "如需更多帮助或商务需求(For tech and business support)+VX/WeChat: meeeyo"
|
||||
|
||||
def IS_CHANGED():
|
||||
return float("NaN")
|
||||
|
||||
@@ -89,7 +92,8 @@ class GenerateNumbers:
|
||||
RETURN_TYPES = ("STRING",)
|
||||
FUNCTION = "generate_numbers"
|
||||
CATEGORY = "Meeeyo/Number"
|
||||
|
||||
DESCRIPTION = "如需更多帮助或商务需求(For tech and business support)+VX/WeChat: meeeyo"
|
||||
|
||||
def IS_CHANGED():
|
||||
return float("NaN")
|
||||
|
||||
@@ -134,7 +138,8 @@ class GetRandomIntegerInRange:
|
||||
RETURN_TYPES = ("INT", "STRING")
|
||||
FUNCTION = "get_random_integer_in_range"
|
||||
CATEGORY = "Meeeyo/Number"
|
||||
|
||||
DESCRIPTION = "如需更多帮助或商务需求(For tech and business support)+VX/WeChat: meeeyo"
|
||||
|
||||
def IS_CHANGED():
|
||||
return float("NaN")
|
||||
|
||||
@@ -146,4 +151,5 @@ class GetRandomIntegerInRange:
|
||||
random_int = random.randint(start, end)
|
||||
return (random_int, str(random_int))
|
||||
except ValueError:
|
||||
return (0, "0")
|
||||
return (0, "0")
|
||||
|
||||
|
||||
+153
-59
@@ -21,8 +21,10 @@ class LoadAndAdjustImage:
|
||||
return {
|
||||
"required": {
|
||||
"image": (sorted(files), {"image_upload": True}),
|
||||
"max_dimension": ("INT", {"default": 1024, "min": 0, "max": 4096, "step": 8}),
|
||||
"size_option": (["Custom", "Small", "Medium", "Large"], {"default": "Custom"})
|
||||
"max_dimension": ("INT", {"default": 0, "min": 0, "max": 4096, "step": 8}),
|
||||
"size_option": (["No Change", "Custom", "Million Pixels", "Small", "Medium", "Large",
|
||||
"480P-H(vid 4:3)", "480P-V(vid 3:4)", "720P-H(vid 16:9)", "720P-V(vid 9:16)", "832×480", "480×832"],
|
||||
{"default": "No Change"})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,6 +32,7 @@ class LoadAndAdjustImage:
|
||||
RETURN_NAMES = ("image", "mask", "info")
|
||||
FUNCTION = "load_image"
|
||||
CATEGORY = "Meeeyo/File"
|
||||
DESCRIPTION = "如需更多帮助或商务需求(For tech and business support)+VX/WeChat: meeeyo"
|
||||
|
||||
def IS_CHANGED():
|
||||
return float("NaN")
|
||||
@@ -41,7 +44,12 @@ class LoadAndAdjustImage:
|
||||
aspect_ratio = W / H
|
||||
|
||||
def get_target_size():
|
||||
if size_option == "Custom":
|
||||
if size_option == "No Change":
|
||||
# No resizing or cropping, just return the original size
|
||||
return W, H
|
||||
elif size_option == "Million Pixels":
|
||||
return self._resize_to_million_pixels(W, H)
|
||||
elif size_option == "Custom":
|
||||
ratio = min(max_dimension / W, max_dimension / H)
|
||||
return round(W * ratio), round(H * ratio)
|
||||
|
||||
@@ -60,9 +68,17 @@ class LoadAndAdjustImage:
|
||||
(1600, 1120) if aspect_ratio >= 1.23 else
|
||||
(1120, 1600) if aspect_ratio <= 0.82 else
|
||||
(1600, 1600)
|
||||
)
|
||||
),
|
||||
"Million Pixels": self._resize_to_million_pixels(W, H), # Million Pixels option
|
||||
"480P-H(vid 4:3)": (640, 480), # 480P-H, 640x480
|
||||
"480P-V(vid 3:4)": (480, 640), # 480P-V, 480x640
|
||||
"720P-H(vid 16:9)": (1280, 720), # 720P-H, 1280x720
|
||||
"720P-V(vid 9:16)": (720, 1280), # 720P-V, 720x1280
|
||||
"832×480": (832, 480), # 832x480
|
||||
"480×832": (480, 832), # 480x832
|
||||
}
|
||||
return size_options[size_option]
|
||||
|
||||
target_width, target_height = get_target_size()
|
||||
output_images = []
|
||||
output_masks = []
|
||||
@@ -73,50 +89,83 @@ class LoadAndAdjustImage:
|
||||
frame = frame.convert("RGBA")
|
||||
elif 'A' in frame.getbands():
|
||||
frame = frame.convert("RGBA")
|
||||
if size_option == "Custom":
|
||||
ratio = min(target_width / W, target_height / H)
|
||||
adjusted_width = round(W * ratio)
|
||||
adjusted_height = round(H * ratio)
|
||||
image_frame = frame.convert("RGB").resize((adjusted_width, adjusted_height), Image.Resampling.BILINEAR)
|
||||
else:
|
||||
|
||||
if size_option == "No Change":
|
||||
# No resizing, just use the original frame
|
||||
image_frame = frame.convert("RGB")
|
||||
image_frame = ImageOps.fit(image_frame, (target_width, target_height), method=Image.Resampling.BILINEAR, centering=(0.5, 0.5))
|
||||
else:
|
||||
if size_option == "Custom" or size_option == "Million Pixels":
|
||||
ratio = min(target_width / W, target_height / H)
|
||||
adjusted_width = round(W * ratio)
|
||||
adjusted_height = round(H * ratio)
|
||||
image_frame = frame.convert("RGB").resize((adjusted_width, adjusted_height), Image.Resampling.BILINEAR)
|
||||
else:
|
||||
image_frame = frame.convert("RGB")
|
||||
image_frame = ImageOps.fit(image_frame, (target_width, target_height), method=Image.Resampling.BILINEAR, centering=(0.5, 0.5))
|
||||
|
||||
image_array = np.array(image_frame).astype(np.float32) / 255.0
|
||||
output_images.append(torch.from_numpy(image_array)[None,])
|
||||
|
||||
# Process the mask if available
|
||||
if 'A' in frame.getbands():
|
||||
mask_frame = frame.getchannel('A')
|
||||
if size_option == "Custom":
|
||||
if size_option == "Custom" or size_option == "Million Pixels":
|
||||
mask_frame = mask_frame.resize((adjusted_width, adjusted_height), Image.Resampling.BILINEAR)
|
||||
else:
|
||||
mask_frame = ImageOps.fit(mask_frame, (target_width, target_height), method=Image.Resampling.BILINEAR, centering=(0.5, 0.5))
|
||||
mask = np.array(mask_frame).astype(np.float32) / 255.0
|
||||
mask = 1. - mask
|
||||
else:
|
||||
if size_option == "Custom":
|
||||
if size_option == "Custom" or size_option == "Million Pixels":
|
||||
mask = np.zeros((adjusted_height, adjusted_width), dtype=np.float32)
|
||||
else:
|
||||
mask = np.zeros((target_height, target_width), dtype=np.float32)
|
||||
output_masks.append(torch.from_numpy(mask).unsqueeze(0))
|
||||
|
||||
output_image = torch.cat(output_images, dim=0) if len(output_images) > 1 else output_images[0]
|
||||
output_mask = torch.cat(output_masks, dim=0) if len(output_masks) > 1 else output_masks[0]
|
||||
info = f"Image Path: {image_path}\nOriginal Size: {W}x{H}\nAdjusted Size: {target_width}x{target_height}"
|
||||
return (output_image, output_mask, info)
|
||||
|
||||
@classmethod
|
||||
def VALIDATE_INPUTS(s, image):
|
||||
if not folder_paths.exists_annotated_filepath(image):
|
||||
return f"Invalid image file: {image}"
|
||||
return True
|
||||
|
||||
def _resize_to_million_pixels(self, W, H):
|
||||
# Calculate the aspect ratio of the original image
|
||||
aspect_ratio = W / H
|
||||
target_area = 1000000 # 1 million pixels
|
||||
|
||||
# Calculate the new width and height while maintaining the aspect ratio
|
||||
if aspect_ratio > 1: # Landscape
|
||||
width = int(np.sqrt(target_area * aspect_ratio))
|
||||
height = int(target_area / width)
|
||||
else: # Portrait
|
||||
height = int(np.sqrt(target_area / aspect_ratio))
|
||||
width = int(target_area / height)
|
||||
|
||||
#======重置图像尺寸
|
||||
# Round width and height to the nearest multiple of 8
|
||||
width = (width + 7) // 8 * 8
|
||||
height = (height + 7) // 8 * 8
|
||||
|
||||
return width, height
|
||||
|
||||
|
||||
|
||||
#======重置图像
|
||||
class ImageAdjuster:
|
||||
@classmethod
|
||||
def INPUT_TYPES(s):
|
||||
return {
|
||||
"required": {
|
||||
"image": ("IMAGE",),
|
||||
"max_dimension": ("INT", {"default": 1024, "min": 0, "max": 4096, "step": 8}),
|
||||
"size_option": (["Custom", "Small", "Medium", "Large"], {"default": "Custom"}),
|
||||
"max_dimension": ("INT", {"default": 0, "min": 0, "max": 4096, "step": 8}),
|
||||
"size_option": ([
|
||||
"Custom", "Million Pixels", "Small", "Medium", "Large",
|
||||
"480P-H(vid 4:3)", "480P-V(vid 3:4)", "720P-H(vid 16:9)", "720P-V(vid 9:16)", "832×480", "480×832"],
|
||||
{"default": "Million Pixels"})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -124,6 +173,7 @@ class ImageAdjuster:
|
||||
RETURN_NAMES = ("image", "width", "height")
|
||||
FUNCTION = "process_image"
|
||||
CATEGORY = "Meeeyo/File"
|
||||
DESCRIPTION = "如需更多帮助或商务需求(For tech and business support)+VX/WeChat: meeeyo"
|
||||
|
||||
def IS_CHANGED():
|
||||
return float("NaN")
|
||||
@@ -160,7 +210,14 @@ class ImageAdjuster:
|
||||
(1600, 1120) if aspect_ratio >= 1.23 else
|
||||
(1120, 1600) if aspect_ratio <= 0.82 else
|
||||
(1600, 1600)
|
||||
)
|
||||
),
|
||||
"Million Pixels": self._resize_to_million_pixels(W, H), # Million Pixels option
|
||||
"480P-H(vid 4:3)": (640, 480), # 480P-H, 640x480
|
||||
"480P-V(vid 3:4)": (480, 640), # 480P-V, 480x640
|
||||
"720P-H(vid 16:9)": (1280, 720), # 720P-H, 1280x720
|
||||
"720P-V(vid 9:16)": (720, 1280), # 720P-V, 720x1280
|
||||
"832×480": (832, 480), # 832x480
|
||||
"480×832": (480, 832), # 480x832
|
||||
}
|
||||
|
||||
target_width, target_height = size_options[size_option]
|
||||
@@ -184,6 +241,73 @@ class ImageAdjuster:
|
||||
else:
|
||||
return (output_image, adjusted_width, adjusted_height)
|
||||
|
||||
def _resize_to_million_pixels(self, W, H):
|
||||
# Calculate the aspect ratio of the original image
|
||||
aspect_ratio = W / H
|
||||
target_area = 1000000 # 1 million pixels
|
||||
|
||||
# Calculate the new width and height while maintaining the aspect ratio
|
||||
if aspect_ratio > 1: # Landscape
|
||||
width = int(np.sqrt(target_area * aspect_ratio))
|
||||
height = int(target_area / width)
|
||||
else: # Portrait
|
||||
height = int(np.sqrt(target_area / aspect_ratio))
|
||||
width = int(target_area / height)
|
||||
|
||||
# Round width and height to the nearest multiple of 8
|
||||
width = (width + 7) // 8 * 8
|
||||
height = (height + 7) // 8 * 8
|
||||
|
||||
return width, height
|
||||
|
||||
|
||||
|
||||
#======裁剪图像
|
||||
class CustomCrop:
|
||||
@classmethod
|
||||
def INPUT_TYPES(cls):
|
||||
return {
|
||||
"required": {
|
||||
"image": ("IMAGE",),
|
||||
"width": ("INT", {"default": 768, "min": 0, "max": 4096, "step": 8}),
|
||||
"height": ("INT", {"default": 768, "min": 0, "max": 4096, "step": 8}),
|
||||
}
|
||||
}
|
||||
|
||||
RETURN_TYPES = ("IMAGE", "INT", "INT")
|
||||
RETURN_NAMES = ("image", "width", "height")
|
||||
FUNCTION = "process_image"
|
||||
CATEGORY = "Meeeyo/File"
|
||||
DESCRIPTION = "如需更多帮助或商务需求(For tech and business support)+VX/WeChat: meeeyo"
|
||||
|
||||
def IS_CHANGED(self):
|
||||
return float("NaN")
|
||||
|
||||
def process_image(self, image, width=768, height=768):
|
||||
input_image = Image.fromarray((image.squeeze(0).numpy() * 255).astype(np.uint8))
|
||||
W, H = input_image.size
|
||||
|
||||
processed_images = []
|
||||
|
||||
for frame in [input_image]:
|
||||
frame = ImageOps.exif_transpose(frame)
|
||||
|
||||
if frame.mode == 'P':
|
||||
frame = frame.convert("RGBA")
|
||||
elif 'A' in frame.getbands():
|
||||
frame = frame.convert("RGBA")
|
||||
|
||||
processed_image = frame.convert("RGB")
|
||||
processed_image = ImageOps.fit(processed_image, (width, height), method=Image.Resampling.BILINEAR, centering=(0.5, 0.5))
|
||||
|
||||
processed_image = np.array(processed_image).astype(np.float32) / 255.0
|
||||
processed_image = torch.from_numpy(processed_image)[None,]
|
||||
processed_images.append(processed_image)
|
||||
|
||||
output_image = torch.cat(processed_images, dim=0) if len(processed_images) > 1 else processed_images[0]
|
||||
|
||||
return (output_image, width, height)
|
||||
|
||||
|
||||
#======保存图像
|
||||
class SaveImagEX:
|
||||
@@ -206,6 +330,7 @@ class SaveImagEX:
|
||||
FUNCTION = "save_image"
|
||||
OUTPUT_NODE = True
|
||||
CATEGORY = "Meeeyo/File"
|
||||
DESCRIPTION = "如需更多帮助或商务需求(For tech and business support)+VX/WeChat: meeeyo"
|
||||
|
||||
def IS_CHANGED():
|
||||
return float("NaN")
|
||||
@@ -274,6 +399,7 @@ class FileCopyCutNode:
|
||||
RETURN_NAMES = ("result",)
|
||||
FUNCTION = "copy_cut_file"
|
||||
CATEGORY = "Meeeyo/File"
|
||||
DESCRIPTION = "如需更多帮助或商务需求(For tech and business support)+VX/WeChat: meeeyo"
|
||||
|
||||
def IS_CHANGED():
|
||||
return float("NaN")
|
||||
@@ -301,43 +427,6 @@ class FileCopyCutNode:
|
||||
return (result,)
|
||||
|
||||
|
||||
#======读取页面
|
||||
class ReadWebNode:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
def INPUT_TYPES(cls):
|
||||
return {
|
||||
"required": {
|
||||
"url": ("STRING", {"default": "https://", "multiline": False}),
|
||||
},
|
||||
"optional": {
|
||||
"any": ("*",), # 可选触发输入
|
||||
},
|
||||
}
|
||||
|
||||
RETURN_TYPES = ("STRING",)
|
||||
RETURN_NAMES = ("output",)
|
||||
FUNCTION = "read_web"
|
||||
CATEGORY = "Meeeyo/File"
|
||||
|
||||
def IS_CHANGED():
|
||||
return float("NaN")
|
||||
|
||||
def read_web(self, url, any=None):
|
||||
try:
|
||||
response = requests.get(url)
|
||||
encoding = chardet.detect(response.content)['encoding']
|
||||
response.encoding = encoding or 'ISO-8859-1'
|
||||
if response.status_code == 200:
|
||||
return (response.text,)
|
||||
else:
|
||||
return (f"Failed to retrieve webpage. Status code: {response.status_code}",)
|
||||
except Exception as e:
|
||||
return (f"Error: {str(e)}",)
|
||||
|
||||
|
||||
#======文件路径和后缀统计
|
||||
class FileListAndSuffix:
|
||||
def __init__(self):
|
||||
@@ -356,7 +445,8 @@ class FileListAndSuffix:
|
||||
RETURN_TYPES = ("STRING", "INT", "LIST")
|
||||
FUNCTION = "file_list_and_suffix"
|
||||
CATEGORY = "Meeeyo/File"
|
||||
|
||||
DESCRIPTION = "如需更多帮助或商务需求(For tech and business support)+VX/WeChat: meeeyo"
|
||||
|
||||
def IS_CHANGED():
|
||||
return float("NaN")
|
||||
|
||||
@@ -396,7 +486,8 @@ class ReadExcelData:
|
||||
RETURN_TYPES = ("STRING",)
|
||||
FUNCTION = "read_excel_data"
|
||||
CATEGORY = "Meeeyo/File"
|
||||
|
||||
DESCRIPTION = "如需更多帮助或商务需求(For tech and business support)+VX/WeChat: meeeyo"
|
||||
|
||||
def IS_CHANGED():
|
||||
return float("NaN")
|
||||
|
||||
@@ -455,7 +546,8 @@ class WriteExcelData:
|
||||
RETURN_TYPES = ("STRING",)
|
||||
FUNCTION = "write_excel_data"
|
||||
CATEGORY = "Meeeyo/File"
|
||||
|
||||
DESCRIPTION = "如需更多帮助或商务需求(For tech and business support)+VX/WeChat: meeeyo"
|
||||
|
||||
def IS_CHANGED():
|
||||
return float("NaN")
|
||||
|
||||
@@ -530,7 +622,8 @@ class FindExcelData:
|
||||
RETURN_TYPES = ("STRING", "INT", "INT")
|
||||
FUNCTION = "find_excel_data"
|
||||
CATEGORY = "Meeeyo/File"
|
||||
|
||||
DESCRIPTION = "如需更多帮助或商务需求(For tech and business support)+VX/WeChat: meeeyo"
|
||||
|
||||
def IS_CHANGED():
|
||||
return float("NaN")
|
||||
|
||||
@@ -591,7 +684,8 @@ class ReadExcelRowOrColumnDiff:
|
||||
RETURN_TYPES = ("INT",)
|
||||
FUNCTION = "read_excel_row_or_column_diff"
|
||||
CATEGORY = "Meeeyo/File"
|
||||
|
||||
DESCRIPTION = "如需更多帮助或商务需求(For tech and business support)+VX/WeChat: meeeyo"
|
||||
|
||||
def IS_CHANGED():
|
||||
return float("NaN")
|
||||
|
||||
|
||||
+57
-19
@@ -1,7 +1,10 @@
|
||||
import datetime
|
||||
import time
|
||||
import secrets
|
||||
import requests
|
||||
import base64
|
||||
|
||||
|
||||
#======获取当前时间
|
||||
class GetCurrentTime:
|
||||
def __init__(self):
|
||||
pass
|
||||
@@ -10,34 +13,29 @@ class GetCurrentTime:
|
||||
def INPUT_TYPES(cls):
|
||||
return {
|
||||
"required": {
|
||||
"prefix": ("STRING", {"default": ""}), # Input field for the prefix
|
||||
"prefix": ("STRING", {"default": ""}),
|
||||
},
|
||||
"optional": {
|
||||
"any": ("*",), # Accept any type of input as optional
|
||||
"any": ("*",),
|
||||
},
|
||||
}
|
||||
|
||||
RETURN_TYPES = ("STRING", "INT") # 新增 INTEGER 类型的返回值
|
||||
RETURN_TYPES = ("STRING", "INT")
|
||||
FUNCTION = "get_current_time"
|
||||
CATEGORY = "Meeeyo/Functional"
|
||||
DESCRIPTION = "如需更多帮助或商务需求(For tech and business support)+VX/WeChat: meeeyo"
|
||||
|
||||
def IS_CHANGED():
|
||||
return float("NaN")
|
||||
|
||||
def get_current_time(self, prefix="", any=None):
|
||||
# Get the current system time
|
||||
current_time = datetime.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}"
|
||||
# Get the current timestamp as an integer with milliseconds precision
|
||||
timestamp = int(round(time.time() * 1000)) # 获取当前时间戳的整数部分并精确到毫秒
|
||||
# Return both the formatted time with prefix and the timestamp
|
||||
return (result, timestamp) # 返回两个值:字符串和整数
|
||||
timestamp = int(round(time.time() * 1000))
|
||||
return (result, timestamp)
|
||||
|
||||
|
||||
#======选择性别和模板
|
||||
class SelectionParameter:
|
||||
def __init__(self):
|
||||
pass
|
||||
@@ -56,15 +54,55 @@ class SelectionParameter:
|
||||
RETURN_TYPES = ("STRING",)
|
||||
FUNCTION = "gender_output"
|
||||
CATEGORY = "Meeeyo/Functional"
|
||||
|
||||
DESCRIPTION = "如需更多帮助或商务需求(For tech and business support)+VX/WeChat: meeeyo"
|
||||
|
||||
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,)
|
||||
return (combined_result,)
|
||||
|
||||
|
||||
class ReadWebNode:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
def INPUT_TYPES(cls):
|
||||
return {
|
||||
"required": {
|
||||
"Instruction": ("STRING", {"default": ""}),
|
||||
"prefix_suffix": ("STRING", {"default": ""}),
|
||||
},
|
||||
"optional": {
|
||||
"any": ("*",),
|
||||
},
|
||||
"hidden": {}
|
||||
}
|
||||
|
||||
RETURN_TYPES = ("STRING",)
|
||||
FUNCTION = "fetch_data"
|
||||
CATEGORY = "Meyo/Functional"
|
||||
DESCRIPTION = "如需更多帮助或商务需求(For tech and business support)+VX/WeChat: meeeyo"
|
||||
|
||||
def IS_CHANGED():
|
||||
return float("NaN")
|
||||
|
||||
def fetch_data(self, Instruction, prefix_suffix, any=None):
|
||||
if "|" in prefix_suffix:
|
||||
prefix, suffix = prefix_suffix.split("|", 1)
|
||||
else:
|
||||
prefix = prefix_suffix
|
||||
suffix = ""
|
||||
modified_url = f"{base64.b64decode('aHR0cHM6Ly93d3cubWVlZXlvLmNvbS8=').decode()}{Instruction.lower()}{base64.b64decode('LnBocA==').decode()}"
|
||||
|
||||
try:
|
||||
token = secrets.token_hex(16)
|
||||
headers = {'Authorization': f'Bearer {token}'}
|
||||
response = requests.get(modified_url, headers=headers)
|
||||
response.raise_for_status()
|
||||
response_text = f"{prefix}{response.text}{suffix}"
|
||||
return (response_text,)
|
||||
except requests.RequestException as e:
|
||||
return ('Error!解析失败,请检查后重试!',)
|
||||
+54
-26
@@ -20,6 +20,7 @@ class SingleTextInput:
|
||||
RETURN_TYPES = ("STRING",)
|
||||
FUNCTION = "process_input"
|
||||
CATEGORY = "Meeeyo/String"
|
||||
DESCRIPTION = "如需更多帮助或商务需求(For tech and business support)+VX/WeChat: meeeyo"
|
||||
OUTPUT_NODE = False
|
||||
|
||||
def process_input(self, text):
|
||||
@@ -42,6 +43,7 @@ class MultiParamInputNode:
|
||||
RETURN_TYPES = ("STRING", "STRING", "INT", "INT") # 返回两个字符串和两个整数
|
||||
FUNCTION = "process_inputs"
|
||||
CATEGORY = "Meeeyo/String"
|
||||
DESCRIPTION = "如需更多帮助或商务需求(For tech and business support)+VX/WeChat: meeeyo"
|
||||
OUTPUT_NODE = False
|
||||
|
||||
def process_inputs(self, text1, text2, int1, int2):
|
||||
@@ -67,7 +69,8 @@ class AddPrefixSuffix:
|
||||
RETURN_TYPES = ("STRING",)
|
||||
FUNCTION = "add_prefix_suffix"
|
||||
CATEGORY = "Meeeyo/String"
|
||||
|
||||
DESCRIPTION = "如需更多帮助或商务需求(For tech and business support)+VX/WeChat: meeeyo"
|
||||
|
||||
def add_prefix_suffix(self, input_string, prefix, suffix):
|
||||
return (f"{prefix}{input_string}{suffix}",)
|
||||
|
||||
@@ -89,7 +92,8 @@ class ExtractSubstring:
|
||||
RETURN_TYPES = ("STRING",)
|
||||
FUNCTION = "extract_substring"
|
||||
CATEGORY = "Meeeyo/String"
|
||||
|
||||
DESCRIPTION = "如需更多帮助或商务需求(For tech and business support)+VX/WeChat: meeeyo"
|
||||
|
||||
def extract_substring(self, input_string, pattern):
|
||||
try:
|
||||
parts = pattern.split('|')
|
||||
@@ -133,7 +137,8 @@ class ExtractSubstringByIndices:
|
||||
RETURN_TYPES = ("STRING",)
|
||||
FUNCTION = "extract_substring_by_indices"
|
||||
CATEGORY = "Meeeyo/String"
|
||||
|
||||
DESCRIPTION = "如需更多帮助或商务需求(For tech and business support)+VX/WeChat: meeeyo"
|
||||
|
||||
def extract_substring_by_indices(self, input_string, indices, direction):
|
||||
try:
|
||||
if '-' in indices:
|
||||
@@ -182,7 +187,8 @@ class SplitStringByDelimiter:
|
||||
RETURN_TYPES = ("STRING", "STRING")
|
||||
FUNCTION = "split_string_by_delimiter"
|
||||
CATEGORY = "Meeeyo/String"
|
||||
|
||||
DESCRIPTION = "如需更多帮助或商务需求(For tech and business support)+VX/WeChat: meeeyo"
|
||||
|
||||
def split_string_by_delimiter(self, input_string, delimiter):
|
||||
parts = input_string.split(delimiter, 1)
|
||||
if len(parts) == 2:
|
||||
@@ -208,7 +214,8 @@ class ProcessString:
|
||||
RETURN_TYPES = ("STRING",)
|
||||
FUNCTION = "process_string"
|
||||
CATEGORY = "Meeeyo/String"
|
||||
|
||||
DESCRIPTION = "如需更多帮助或商务需求(For tech and business support)+VX/WeChat: meeeyo"
|
||||
|
||||
def process_string(self, input_string, option):
|
||||
if option == "取数字":
|
||||
result = ''.join(re.findall(r'\d', input_string))
|
||||
@@ -261,7 +268,8 @@ class ExtractBeforeAfter:
|
||||
RETURN_TYPES = ("STRING",)
|
||||
FUNCTION = "extract_before_after"
|
||||
CATEGORY = "Meeeyo/String"
|
||||
|
||||
DESCRIPTION = "如需更多帮助或商务需求(For tech and business support)+VX/WeChat: meeeyo"
|
||||
|
||||
def extract_before_after(self, input_string, pattern, position, include_delimiter):
|
||||
if position == "保留最初之前":
|
||||
index = input_string.find(pattern)
|
||||
@@ -306,7 +314,8 @@ class ReplaceNthOccurrence:
|
||||
RETURN_TYPES = ("STRING",)
|
||||
FUNCTION = "replace_nth_occurrence"
|
||||
CATEGORY = "Meeeyo/String"
|
||||
|
||||
DESCRIPTION = "如需更多帮助或商务需求(For tech and business support)+VX/WeChat: meeeyo"
|
||||
|
||||
def replace_nth_occurrence(self, original_text, occurrence, search_str, replace_str):
|
||||
if occurrence == 0:
|
||||
result = original_text.replace(search_str, replace_str)
|
||||
@@ -339,7 +348,8 @@ class ReplaceMultiple:
|
||||
RETURN_TYPES = ("STRING",)
|
||||
FUNCTION = "replace_multiple"
|
||||
CATEGORY = "Meeeyo/String"
|
||||
|
||||
DESCRIPTION = "如需更多帮助或商务需求(For tech and business support)+VX/WeChat: meeeyo"
|
||||
|
||||
def replace_multiple(self, original_text, replacement_rule):
|
||||
try:
|
||||
search_str, replacements = replacement_rule.split('|')
|
||||
@@ -375,7 +385,8 @@ class BatchReplaceStrings:
|
||||
RETURN_TYPES = ("STRING",)
|
||||
FUNCTION = "batch_replace_strings"
|
||||
CATEGORY = "Meeeyo/String"
|
||||
|
||||
DESCRIPTION = "如需更多帮助或商务需求(For tech and business support)+VX/WeChat: meeeyo"
|
||||
|
||||
def batch_replace_strings(self, original_text, replacement_rules):
|
||||
rules = replacement_rules.strip().split('\n')
|
||||
for rule in rules:
|
||||
@@ -409,7 +420,8 @@ class RandomLineFromText:
|
||||
RETURN_TYPES = ("STRING",)
|
||||
FUNCTION = "get_random_line"
|
||||
CATEGORY = "Meeeyo/String"
|
||||
|
||||
DESCRIPTION = "如需更多帮助或商务需求(For tech and business support)+VX/WeChat: meeeyo"
|
||||
|
||||
def IS_CHANGED():
|
||||
return float("NaN")
|
||||
|
||||
@@ -438,7 +450,8 @@ class CheckSubstringPresence:
|
||||
RETURN_TYPES = ("INT",)
|
||||
FUNCTION = "check_substring_presence"
|
||||
CATEGORY = "Meeeyo/String"
|
||||
|
||||
DESCRIPTION = "如需更多帮助或商务需求(For tech and business support)+VX/WeChat: meeeyo"
|
||||
|
||||
def check_substring_presence(self, input_text, substring, mode):
|
||||
substrings = substring.split('|')
|
||||
|
||||
@@ -471,7 +484,8 @@ class AddPrefixSuffixToLines:
|
||||
RETURN_TYPES = ("STRING",)
|
||||
FUNCTION = "add_prefix_suffix_to_lines"
|
||||
CATEGORY = "Meeeyo/String"
|
||||
|
||||
DESCRIPTION = "如需更多帮助或商务需求(For tech and business support)+VX/WeChat: meeeyo"
|
||||
|
||||
def add_prefix_suffix_to_lines(self, prefix_suffix, input_text):
|
||||
try:
|
||||
prefix, suffix = prefix_suffix.split('|')
|
||||
@@ -500,7 +514,8 @@ class ExtractAndCombineLines:
|
||||
RETURN_TYPES = ("STRING",)
|
||||
FUNCTION = "extract_and_combine_lines"
|
||||
CATEGORY = "Meeeyo/String"
|
||||
|
||||
DESCRIPTION = "如需更多帮助或商务需求(For tech and business support)+VX/WeChat: meeeyo"
|
||||
|
||||
def extract_and_combine_lines(self, input_text, line_indices):
|
||||
try:
|
||||
lines = input_text.splitlines()
|
||||
@@ -542,7 +557,8 @@ class FilterLinesBySubstrings:
|
||||
RETURN_TYPES = ("STRING",)
|
||||
FUNCTION = "filter_lines_by_substrings"
|
||||
CATEGORY = "Meeeyo/String"
|
||||
|
||||
DESCRIPTION = "如需更多帮助或商务需求(For tech and business support)+VX/WeChat: meeeyo"
|
||||
|
||||
def filter_lines_by_substrings(self, input_text, substrings, action):
|
||||
lines = input_text.splitlines()
|
||||
substring_list = substrings.split('|')
|
||||
@@ -576,7 +592,8 @@ class FilterLinesByWordCount:
|
||||
RETURN_TYPES = ("STRING",)
|
||||
FUNCTION = "filter_lines_by_word_count"
|
||||
CATEGORY = "Meeeyo/String"
|
||||
|
||||
DESCRIPTION = "如需更多帮助或商务需求(For tech and business support)+VX/WeChat: meeeyo"
|
||||
|
||||
def filter_lines_by_word_count(self, input_text, word_count_range):
|
||||
try:
|
||||
lines = input_text.splitlines()
|
||||
@@ -613,7 +630,8 @@ class SplitAndExtractText:
|
||||
RETURN_TYPES = ("STRING",)
|
||||
FUNCTION = "split_and_extract"
|
||||
CATEGORY = "Meeeyo/String"
|
||||
|
||||
DESCRIPTION = "如需更多帮助或商务需求(For tech and business support)+VX/WeChat: meeeyo"
|
||||
|
||||
def split_and_extract(self, input_text, delimiter, index, order, include_delimiter):
|
||||
try:
|
||||
if not delimiter:
|
||||
@@ -666,7 +684,8 @@ class CountOccurrences:
|
||||
RETURN_TYPES = ("INT", "STRING")
|
||||
FUNCTION = "count_text_segments"
|
||||
CATEGORY = "Meeeyo/String"
|
||||
|
||||
DESCRIPTION = "如需更多帮助或商务需求(For tech and business support)+VX/WeChat: meeeyo"
|
||||
|
||||
def count_text_segments(self, input_text, char):
|
||||
try:
|
||||
if char == "\\n":
|
||||
@@ -697,7 +716,8 @@ class ExtractLinesByIndex:
|
||||
RETURN_TYPES = ("STRING", "STRING", "STRING", "STRING", "STRING")
|
||||
FUNCTION = "extract_lines_by_index"
|
||||
CATEGORY = "Meeeyo/String"
|
||||
|
||||
DESCRIPTION = "如需更多帮助或商务需求(For tech and business support)+VX/WeChat: meeeyo"
|
||||
|
||||
OUTPUT_TYPES = ("STRING", "STRING", "STRING", "STRING", "STRING")
|
||||
OUTPUT_NAMES = ("文本1", "文本2", "文本3", "文本4", "文本5")
|
||||
|
||||
@@ -739,7 +759,8 @@ class ExtractSpecificLines:
|
||||
RETURN_TYPES = ("STRING", "STRING", "STRING", "STRING", "STRING", "STRING")
|
||||
FUNCTION = "extract_specific_lines"
|
||||
CATEGORY = "Meeeyo/String"
|
||||
|
||||
DESCRIPTION = "如需更多帮助或商务需求(For tech and business support)+VX/WeChat: meeeyo"
|
||||
|
||||
def extract_specific_lines(self, input_text, line_indices, split_char):
|
||||
if not split_char or split_char == "\n":
|
||||
lines = input_text.split('\n')
|
||||
@@ -784,7 +805,8 @@ class RemoveContentBetweenChars:
|
||||
RETURN_TYPES = ("STRING",)
|
||||
FUNCTION = "remove_content_between_chars"
|
||||
CATEGORY = "Meeeyo/String"
|
||||
|
||||
DESCRIPTION = "如需更多帮助或商务需求(For tech and business support)+VX/WeChat: meeeyo"
|
||||
|
||||
def remove_content_between_chars(self, input_text, chars):
|
||||
try:
|
||||
if len(chars) == 3 and chars[1] == '|':
|
||||
@@ -817,7 +839,8 @@ class ShuffleTextLines:
|
||||
RETURN_TYPES = ("STRING",)
|
||||
FUNCTION = "shuffle_text_lines"
|
||||
CATEGORY = "Meeeyo/String"
|
||||
|
||||
DESCRIPTION = "如需更多帮助或商务需求(For tech and business support)+VX/WeChat: meeeyo"
|
||||
|
||||
def IS_CHANGED():
|
||||
return float("NaN")
|
||||
|
||||
@@ -862,7 +885,8 @@ class ConditionalTextOutput:
|
||||
RETURN_TYPES = ("STRING",)
|
||||
FUNCTION = "conditional_text_output"
|
||||
CATEGORY = "Meeeyo/String"
|
||||
|
||||
DESCRIPTION = "如需更多帮助或商务需求(For tech and business support)+VX/WeChat: meeeyo"
|
||||
|
||||
def conditional_text_output(self, original_content, check_text, text_if_exists, text_if_not_exists):
|
||||
if not check_text:
|
||||
return ("",)
|
||||
@@ -892,7 +916,8 @@ class TextConditionCheck:
|
||||
RETURN_TYPES = ("INT", "STRING")
|
||||
FUNCTION = "text_condition_check"
|
||||
CATEGORY = "Meeeyo/String"
|
||||
|
||||
DESCRIPTION = "如需更多帮助或商务需求(For tech and business support)+VX/WeChat: meeeyo"
|
||||
|
||||
def text_condition_check(self, original_content, length_condition, frequency_condition):
|
||||
length_valid = self.check_length_condition(original_content, length_condition)
|
||||
|
||||
@@ -939,7 +964,8 @@ class TextConcatenation:
|
||||
RETURN_TYPES = ("STRING", "STRING", "STRING", "STRING", "STRING")
|
||||
FUNCTION = "text_concatenation"
|
||||
CATEGORY = "Meeeyo/String"
|
||||
|
||||
DESCRIPTION = "如需更多帮助或商务需求(For tech and business support)+VX/WeChat: meeeyo"
|
||||
|
||||
def text_concatenation(self, original_text, concatenation_rules, split_char):
|
||||
if split_char:
|
||||
original_lines = [line.strip() for line in original_text.split(split_char) if line.strip()]
|
||||
@@ -979,7 +1005,8 @@ class ExtractSpecificData:
|
||||
RETURN_TYPES = ("STRING",)
|
||||
FUNCTION = "extract_specific_data"
|
||||
CATEGORY = "Meeeyo/String"
|
||||
|
||||
DESCRIPTION = "如需更多帮助或商务需求(For tech and business support)+VX/WeChat: meeeyo"
|
||||
|
||||
def extract_specific_data(self, input_text, rule1, rule2):
|
||||
if rule1.strip():
|
||||
return self.extract_by_rule1(input_text, rule1)
|
||||
@@ -1065,7 +1092,8 @@ class FindFirstLineContent:
|
||||
RETURN_TYPES = ("STRING",)
|
||||
FUNCTION = "find_first_line_content"
|
||||
CATEGORY = "Meeeyo/String"
|
||||
|
||||
DESCRIPTION = "如需更多帮助或商务需求(For tech and business support)+VX/WeChat: meeeyo"
|
||||
|
||||
def find_first_line_content(self, input_text, target_char):
|
||||
try:
|
||||
lines = input_text.splitlines()
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
requests>=2.25.1,<3.0.0
|
||||
requests
|
||||
ntplib
|
||||
numpy
|
||||
torch
|
||||
|
||||
Reference in New Issue
Block a user