feat: Add video tools module registration and constants

This commit is contained in:
chyer
2025-08-31 20:00:10 +08:00
parent 7a16518647
commit fa495a2d06
3 changed files with 16 additions and 6 deletions
+14 -6
View File
@@ -31,6 +31,10 @@ try:
NODE_CLASS_MAPPINGS as PROMPT_TOOLS_CLASS_MAPPINGS,
NODE_DISPLAY_NAME_MAPPINGS as PROMPT_TOOLS_DISPLAY_MAPPINGS
)
from categories.video_tools import (
NODE_CLASS_MAPPINGS as VIDEO_CLASS_MAPPINGS,
NODE_DISPLAY_NAME_MAPPINGS as VIDEO_DISPLAY_MAPPINGS
)
except ImportError:
# Fallback for ComfyUI environments
import importlib.util
@@ -75,9 +79,13 @@ except ImportError:
PROMPT_TOOLS_CLASS_MAPPINGS = prompt_tools.NODE_CLASS_MAPPINGS
PROMPT_TOOLS_DISPLAY_MAPPINGS = prompt_tools.NODE_DISPLAY_NAME_MAPPINGS
# Video tools module doesn't exist yet
VIDEO_CLASS_MAPPINGS = {}
VIDEO_DISPLAY_MAPPINGS = {}
# Import video tools
spec = importlib.util.spec_from_file_location("video_tools", os.path.join(current_dir, "categories", "video_tools.py"))
video_tools = importlib.util.module_from_spec(spec)
spec.loader.exec_module(video_tools)
VIDEO_CLASS_MAPPINGS = video_tools.NODE_CLASS_MAPPINGS
VIDEO_DISPLAY_MAPPINGS = video_tools.NODE_DISPLAY_NAME_MAPPINGS
# Combine all category mappings
@@ -104,9 +112,9 @@ NODE_DISPLAY_NAME_MAPPINGS.update(POST_PROCESS_DISPLAY_MAPPINGS)
NODE_CLASS_MAPPINGS.update(PROMPT_TOOLS_CLASS_MAPPINGS)
NODE_DISPLAY_NAME_MAPPINGS.update(PROMPT_TOOLS_DISPLAY_MAPPINGS)
# Video tools module doesn't exist yet (commented out for future use)
# NODE_CLASS_MAPPINGS.update(VIDEO_CLASS_MAPPINGS)
# NODE_DISPLAY_NAME_MAPPINGS.update(VIDEO_DISPLAY_MAPPINGS)
# Add video tools
NODE_CLASS_MAPPINGS.update(VIDEO_CLASS_MAPPINGS)
NODE_DISPLAY_NAME_MAPPINGS.update(VIDEO_DISPLAY_MAPPINGS)
# API endpoints for web extensions
+1
View File
@@ -6,6 +6,7 @@ from .latent_tools import *
from .math_tools import *
from .file_tools import *
from .post_process import *
from .video_tools import *
# Import other category modules as they are added
# from .image_tools import *
+1
View File
@@ -71,6 +71,7 @@ MATH_CATEGORY = "math"
FILE_CATEGORY = "file"
POST_PROCESS_CATEGORY = "post_process"
PROMPT_TOOLS_CATEGORY = "prompt_tools"
VIDEO_CATEGORY = "video"
# Math node constants
DEFAULT_MULTIPLIER_VALUE = 32