From d7c671aff8c3712698618ecafc0373993819218d Mon Sep 17 00:00:00 2001 From: Meisoftcoltd <38667978+Meisoftcoltd@users.noreply.github.com> Date: Sat, 28 Mar 2026 15:43:06 +0000 Subject: [PATCH] Replace VHS validation in LoadVideoWithSourceAudio with native file checking - Removed dependency on VHS_LoadVideo cache and validation methods - Replaced IS_CHANGED to check modification time instead of slow SHA256 - Replaced VALIDATE_INPUTS to check file existence directly and absorb kwargs - These changes improve the node's independence and speed for large files --- video.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/video.py b/video.py index 1ff8cf5..4e711df 100644 --- a/video.py +++ b/video.py @@ -185,16 +185,20 @@ class LoadVideoWithSourceAudio: @classmethod def IS_CHANGED(s, video, **kwargs): - vhs_class = nodes.NODE_CLASS_MAPPINGS.get("VHS_LoadVideo") - if vhs_class and hasattr(vhs_class, "IS_CHANGED"): - return vhs_class.IS_CHANGED(video, **kwargs) + # Lógica propia: Comprobamos si el vídeo ha cambiado usando su fecha de modificación en disco. + # Es mucho más rápido que calcular el hash SHA256 de un archivo de vídeo gigante. + video_path = folder_paths.get_annotated_filepath(video) + if os.path.exists(video_path): + return os.path.getmtime(video_path) return float("NaN") @classmethod def VALIDATE_INPUTS(s, video, **kwargs): - vhs_class = nodes.NODE_CLASS_MAPPINGS.get("VHS_LoadVideo") - if vhs_class and hasattr(vhs_class, "VALIDATE_INPUTS"): - return vhs_class.VALIDATE_INPUTS(video, **kwargs) + # Lógica propia: Comprobamos directamente si la ruta del archivo existe. + # Al aceptar **kwargs, absorbemos cualquier parámetro extra (como force_rate) sin que Python explote. + video_path = folder_paths.get_annotated_filepath(video) + if not os.path.exists(video_path): + return f"❌ El archivo de vídeo no existe en la ruta: {video_path}" return True def load_video_with_audio(self, **kwargs):