From 0c0288f9b5edc4e09a050b659ecec38fa18788cf Mon Sep 17 00:00:00 2001 From: Austin Mroz Date: Mon, 14 Apr 2025 02:28:36 -0500 Subject: [PATCH] Add duration option to Load Audio (Path) Functionality already exists in Upload variant and backing util function, so the change is negligible. Also commit to minor version bump. Other concommitant changes also break forwards compatibility, so it's a chance to roll multiple together even if this bump doesn't accompany anything big or flashy. --- pyproject.toml | 2 +- videohelpersuite/nodes.py | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index e853373..52c349a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,7 @@ [project] name = "comfyui-videohelpersuite" description = "Nodes related to video workflows" -version = "1.5.19" +version = "1.6.0" license = { file = "LICENSE" } dependencies = ["opencv-python", "imageio-ffmpeg"] diff --git a/videohelpersuite/nodes.py b/videohelpersuite/nodes.py index baeea1d..b42a0f3 100755 --- a/videohelpersuite/nodes.py +++ b/videohelpersuite/nodes.py @@ -627,14 +627,16 @@ class LoadAudio: "required": { "audio_file": ("STRING", {"default": "input/", "vhs_path_extensions": ['wav','mp3','ogg','m4a','flac']}), }, - "optional" : {"seek_seconds": ("FLOAT", {"default": 0, "min": 0})} + "optional" : {"seek_seconds": ("FLOAT", {"default": 0, "min": 0}), + "duration": ("FLOAT" , {"default": 0, "min": 0, "max": 10000000, "step": 0.01}), + } } RETURN_TYPES = ("AUDIO",) RETURN_NAMES = ("audio",) CATEGORY = "Video Helper Suite 🎥🅥🅗🅢/audio" FUNCTION = "load_audio" - def load_audio(self, audio_file, seek_seconds): + def load_audio(self, audio_file, seek_seconds, duration): audio_file = strip_path(audio_file) if audio_file is None or validate_path(audio_file) != True: raise Exception("audio_file is not a valid path: " + audio_file) @@ -642,7 +644,7 @@ class LoadAudio: audio_file = try_download_video(audio_file) or audio_file #Eagerly fetch the audio since the user must be using it if the #node executes, unlike Load Video - return (get_audio(audio_file, start_time=seek_seconds),) + return (get_audio(audio_file, start_time=seek_seconds, duration=duration),) @classmethod def IS_CHANGED(s, audio_file, seek_seconds):