mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-02-06 11:32:31 +08:00
Added strict_duration bool to node definition
This commit is contained in:
parent
fa8241f85e
commit
0864bcec00
@ -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(
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user