Added strict_duration bool to node definition

This commit is contained in:
Jedrzej Kosinski 2026-01-31 00:01:27 -08:00
parent fa8241f85e
commit 0864bcec00

View File

@ -232,6 +232,11 @@ class VideoSlice(io.ComfyNode):
step=0.001, step=0.001,
tooltip="Duration in seconds, or 0 for unlimited duration", tooltip="Duration in seconds, or 0 for unlimited duration",
), ),
io.Boolean.Input(
"strict_duration",
default=False,
tooltip="If True, when the specified duration is not possible, an error will be raised.",
),
], ],
outputs=[ outputs=[
io.Video.Output(), io.Video.Output(),
@ -239,8 +244,8 @@ class VideoSlice(io.ComfyNode):
) )
@classmethod @classmethod
def execute(cls, video, start_time, duration) -> io.NodeOutput: def execute(cls, video: io.Video.Type, start_time: float, duration: float, strict_duration: bool) -> io.NodeOutput:
trimmed = video.as_trimmed(start_time, duration, strict_duration=False) trimmed = video.as_trimmed(start_time, duration, strict_duration=strict_duration)
if trimmed is not None: if trimmed is not None:
return io.NodeOutput(trimmed) return io.NodeOutput(trimmed)
raise ValueError( raise ValueError(