Fix: Audio Wave node uncreatable when ComfyUI/input has no audio (empty combo)
An empty combo ([],) can't be built by ComfyUI, so the node wouldn't add to the canvas. _audio_files() now always returns at least a placeholder entry. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -69,17 +69,23 @@ def _segments_from_boundaries(rms_n, times, duration, fps, starts, beats):
|
|||||||
return segs, bounds
|
return segs, bounds
|
||||||
|
|
||||||
|
|
||||||
|
_NO_AUDIO = "(put an audio file in ComfyUI/input)"
|
||||||
|
|
||||||
|
|
||||||
def _audio_files():
|
def _audio_files():
|
||||||
|
files = []
|
||||||
try:
|
try:
|
||||||
import folder_paths
|
import folder_paths
|
||||||
d = folder_paths.get_input_directory()
|
d = folder_paths.get_input_directory()
|
||||||
try:
|
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:
|
except Exception:
|
||||||
exts = (".wav", ".mp3", ".flac", ".ogg", ".m4a", ".aac")
|
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:
|
except Exception:
|
||||||
return []
|
files = []
|
||||||
|
# A combo must never be empty, or ComfyUI can't build the node.
|
||||||
|
return files or [_NO_AUDIO]
|
||||||
|
|
||||||
|
|
||||||
class AudioWaveSegments:
|
class AudioWaveSegments:
|
||||||
|
|||||||
Reference in New Issue
Block a user