feat: allow absolute paths in VideoAnalyzerWithAudio
Update `VideoAnalyzerWithAudio` in `video.py` to support absolute paths for the `video_name` parameter. The node's `IS_CHANGED`, `VALIDATE_INPUTS`, and `analyze` methods have been modified to first check if the provided path exists directly using `os.path.exists()`. If it does, it uses the path directly, enabling the use of absolute paths. Otherwise, it falls back to the default `folder_paths.get_annotated_filepath()`.
This commit is contained in:
@@ -46,7 +46,11 @@ class VideoAnalyzerWithAudio:
|
||||
def IS_CHANGED(cls, video, **kwargs):
|
||||
# Romper el caché si el archivo ha sido modificado en disco
|
||||
video_name = video[0] if isinstance(video, (list, tuple)) else video
|
||||
video_path = folder_paths.get_annotated_filepath(video_name)
|
||||
if os.path.exists(video_name):
|
||||
video_path = video_name
|
||||
else:
|
||||
video_path = folder_paths.get_annotated_filepath(video_name)
|
||||
|
||||
if os.path.exists(video_path):
|
||||
return os.path.getmtime(video_path)
|
||||
return time.time()
|
||||
@@ -54,14 +58,21 @@ class VideoAnalyzerWithAudio:
|
||||
@classmethod
|
||||
def VALIDATE_INPUTS(cls, video, **kwargs):
|
||||
video_name = video[0] if isinstance(video, (list, tuple)) else video
|
||||
video_path = folder_paths.get_annotated_filepath(video_name)
|
||||
if os.path.exists(video_name):
|
||||
video_path = video_name
|
||||
else:
|
||||
video_path = folder_paths.get_annotated_filepath(video_name)
|
||||
|
||||
if not os.path.exists(video_path):
|
||||
return f"❌ El archivo de video no existe en: {video_path}"
|
||||
return True
|
||||
|
||||
def analyze(self, video, reference_frame_idx, use_face_detector, blur_threshold, **kwargs):
|
||||
video_name = video[0] if isinstance(video, (list, tuple)) else video
|
||||
video_path = folder_paths.get_annotated_filepath(video_name)
|
||||
if os.path.exists(video_name):
|
||||
video_path = video_name
|
||||
else:
|
||||
video_path = folder_paths.get_annotated_filepath(video_name)
|
||||
|
||||
print(f"\n{'='*50}")
|
||||
print(f"🕵️ [DEBUG] NODO: Video Analyzer (Explorador)")
|
||||
|
||||
Reference in New Issue
Block a user