mirror of
https://git.datalinker.icu/kijai/ComfyUI-KJNodes.git
synced 2026-01-02 04:58:41 +08:00
### Extended Description This commit addresses the AttributeError in the LoadVideosFromFolder node from ComfyUI-KJNodes, where the VHS (VideoHelperSuite) module lacked the 'load_video_nodes' attribute. The issue arose due to inconsistent module naming and import failures on Windows systems. #### Key Changes: - Improved `__init__` method: Simplified the fallback logic for importing VHS modules. Added case-insensitive checks for module names in `sys.modules` to handle platform-specific import variations (e.g., "ComfyUI-VideoHelperSuite" vs. "comfyui-videohelpersuite"). This ensures robust loading of the `videohelpersuite` submodule across different environments. - Optimized `load_video` method: - Changed `VIDEO_EXTS` from a set to a list for simplicity (no performance impact for small collections). - Moved file processing logic (e.g., `root = kwargs['video']`, directory scanning, and video list preparation). #### Testing: - Verified that the node now correctly imports VHS modules without errors. - The original order (from os.listdir()) was clip1, clip3, clip2 (unsorted). After applying natural sorting with _natural_key, the order becomes clip1, clip2, clip3 (correct numerical order). This resolves the import issues reported in the KJNodes repository and improves the overall reliability of video loading features.