Files
Meisoftcoltd-comfyui-sequen…/modify_facedetector.py
T
Meisoftcoltd 5983ff65b4 feat: rename video analyzer to face detector, add global cache, and introduce scene detector node
- Renamed `VideoAnalyzerWithAudio` to `VideoAnalyzerFaceDetector`.
- Introduced `VIDEO_ANALYSIS_CACHE` and `current_loop_index` for cycle caching.
- Created `VideoAnalyzerSceneDetector` to detect scene changes via pixel difference.
- Added dynamic reference frame preview functionality outside the caching logic.
- Registered nodes with proper display names in `__init__.py`.
2026-04-24 21:29:55 +00:00

25 lines
1012 B
Python

import re
def update_node():
with open('video.py', 'r') as f:
content = f.read()
# Update INPUT_TYPES optional
content = re.sub(
r'"optional": \{\s*"bbox_detector": \("BBOX_DETECTOR", \),\s*# 💡 Puerto para YOLO/ONNX\s*\}',
'"optional": {\n "bbox_detector": ("BBOX_DETECTOR", ), # 💡 Puerto para YOLO/ONNX\n "current_loop_index": ("INT", {"default": 0, "forceInput": True}),\n }',
content
)
# Update analyze method signature
content = content.replace(
'def analyze(self, video, reference_frame_idx, use_face_detector, blur_threshold, unload_detector_after_analysis=True, bbox_detector=None, **kwargs):',
'def analyze(self, video, reference_frame_idx, use_face_detector, blur_threshold, unload_detector_after_analysis=True, bbox_detector=None, current_loop_index=0, **kwargs):'
)
with open('video.py', 'w') as f:
f.write(content)
if __name__ == '__main__':
update_node()