- 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`.
31 lines
1002 B
Python
31 lines
1002 B
Python
import re
|
|
|
|
def update_node():
|
|
with open('video.py', 'r') as f:
|
|
content = f.read()
|
|
|
|
# Find the analyze method of VideoAnalyzerFaceDetector
|
|
search_str = '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):'
|
|
idx = content.find(search_str)
|
|
if idx == -1:
|
|
print("Analyze method not found")
|
|
return
|
|
|
|
# Find where to insert caching logic inside analyze
|
|
target_str = 'video_path = folder_paths.get_annotated_filepath(video)'
|
|
target_idx = content.find(target_str, idx)
|
|
if target_idx == -1:
|
|
print("Target string not found")
|
|
return
|
|
|
|
insert_idx = target_idx + len(target_str)
|
|
|
|
# We replace the original logic starting from _log(f"\n{'='*50}") until frame extraction
|
|
|
|
# Actually, let's completely rewrite the analyze method for VideoAnalyzerFaceDetector
|
|
|
|
pass
|
|
|
|
if __name__ == '__main__':
|
|
update_node()
|