diff --git a/nodes/audio_wave_segments.py b/nodes/audio_wave_segments.py index 1222947..f009b07 100644 --- a/nodes/audio_wave_segments.py +++ b/nodes/audio_wave_segments.py @@ -69,17 +69,23 @@ def _segments_from_boundaries(rms_n, times, duration, fps, starts, beats): return segs, bounds +_NO_AUDIO = "(put an audio file in ComfyUI/input)" + + def _audio_files(): + files = [] try: import folder_paths d = folder_paths.get_input_directory() try: - return sorted(folder_paths.filter_files_content_types(os.listdir(d), ["audio", "video"])) + files = sorted(folder_paths.filter_files_content_types(os.listdir(d), ["audio", "video"])) except Exception: exts = (".wav", ".mp3", ".flac", ".ogg", ".m4a", ".aac") - return sorted(f for f in os.listdir(d) if f.lower().endswith(exts)) + files = sorted(f for f in os.listdir(d) if f.lower().endswith(exts)) except Exception: - return [] + files = [] + # A combo must never be empty, or ComfyUI can't build the node. + return files or [_NO_AUDIO] class AudioWaveSegments: