Files
daxcay-ComfyUI-JDCN/classes/JDCN_AnyFileSelector.py
T
daxcay f648ca7e45 Update
-inner folder for nodes
2024-05-01 22:09:22 +05:30

59 lines
1.2 KiB
Python

import os
import numpy as np
class AlwaysEqualProxy(str):
def __eq__(self, _):
return True
def __ne__(self, _):
return False
class JDCN_AnyFileSelector:
def __init__(self):
pass
@classmethod
def INPUT_TYPES(s):
return {
"required": {
"PathList": ("STRING", {"forceInput": True}),
"Index": ("INT", {"default": 1, "min": 1, "max": 9999}),
"Change": (['fixed', 'increment', 'decrement'],)
},
}
INPUT_IS_LIST = True
RETURN_TYPES = ("STRING",)
RETURN_NAMES = ("out",)
OUTPUT_NODE = True
FUNCTION = "make_list"
CATEGORY = "🔵 JDCN 🔵"
def make_list(self, PathList, Index, Change):
Index = Index[0] - 1
if len(PathList) == 0:
print("Error in List Variable")
return None
if Index < 0 or Index >= len(PathList):
print("Error in List Variable")
return None
return (PathList[Index],)
N_CLASS_MAPPINGS = {
"JDCN_AnyFileSelector": JDCN_AnyFileSelector,
}
N_DISPLAY_NAME_MAPPINGS = {
"JDCN_AnyFileSelector": "JDCN_AnyFileSelector",
}