Files
AEmotionStudio-ComfyUI-Disc…/shared/__init__.py
T
AEmotionStudioandClaude Opus 4.5 a208cd482b refactor(phase2): extract shared utilities and reduce node duplication
- Create shared/filename_utils.py for date/time/dimension filename building
- Create shared/path_utils.py for output directory handling
- Create shared/discord/message_builder.py for Discord message construction
- Create shared/discord/cdn_extractor.py for CDN URL extraction
- Refactor image_node.py to use shared utilities (-161 lines, 16.3%)
- Refactor video_node.py to use shared utilities (-361 lines, 23.1%)
- Fix setup_logging missing from logging_config.py
- Fix test imports to use new module paths (nodes.* instead of discord_*_node)
- Total reduction: 522 lines (20.5%), exceeding PRD target of ~200 lines

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-19 23:33:10 -08:00

67 lines
2.0 KiB
Python

"""
ComfyUI-DiscordSend Shared Utilities
This package contains shared utilities used by both ComfyUI nodes and the Discord bot.
Organized into subpackages:
- discord: Discord webhook and message utilities
- media: Image and video processing utilities
- workflow: ComfyUI workflow manipulation utilities
"""
# Re-export commonly used utilities for convenience
from .workflow.sanitizer import sanitize_json_for_export
from .workflow.prompt_extractor import extract_prompts_from_workflow
from .workflow.workflow_builder import WorkflowBuilder
from .discord.webhook_client import (
DiscordWebhookClient,
validate_webhook_url,
send_to_discord_with_retry
)
from .discord.message_builder import (
build_metadata_section,
build_prompt_section,
build_discord_message,
format_file_size
)
from .discord.cdn_extractor import (
extract_cdn_urls_from_response,
send_cdn_urls_file
)
from .media.image_processing import tensor_to_numpy_uint8
from .github_integration import update_github_cdn_urls
from .logging_config import setup_logging, get_logger
from .filename_utils import build_filename_with_metadata, get_timestamp_string
from .path_utils import get_output_directory, ensure_directory_exists
__all__ = [
# Workflow utilities
'sanitize_json_for_export',
'extract_prompts_from_workflow',
'WorkflowBuilder',
# Discord utilities
'DiscordWebhookClient',
'validate_webhook_url',
'send_to_discord_with_retry',
# Discord message building
'build_metadata_section',
'build_prompt_section',
'build_discord_message',
'format_file_size',
# CDN extraction
'extract_cdn_urls_from_response',
'send_cdn_urls_file',
# Media utilities
'tensor_to_numpy_uint8',
# GitHub integration
'update_github_cdn_urls',
# Logging
'setup_logging',
'get_logger',
# Filename utilities
'build_filename_with_metadata',
'get_timestamp_string',
# Path utilities
'get_output_directory',
'ensure_directory_exists',
]