From aaa3bcc2334f4eb4791979238fa619b8ad9643bd Mon Sep 17 00:00:00 2001 From: Yousef Rafat <81116377+yousef-rafat@users.noreply.github.com> Date: Sat, 27 Sep 2025 14:28:26 +0300 Subject: [PATCH] fixed a small bug --- comfy/text_encoders/llama.py | 2 +- comfy_api/latest/_input_impl/video_types.py | 11 ++++------- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/comfy/text_encoders/llama.py b/comfy/text_encoders/llama.py index 3615cfe97..5e11956b5 100644 --- a/comfy/text_encoders/llama.py +++ b/comfy/text_encoders/llama.py @@ -428,4 +428,4 @@ class Gemma2_2B(BaseLlama, torch.nn.Module): self.num_layers = config.num_hidden_layers self.model = Llama2_(config, device=device, dtype=dtype, ops=operations) - self.dtype = dtype \ No newline at end of file + self.dtype = dtype diff --git a/comfy_api/latest/_input_impl/video_types.py b/comfy_api/latest/_input_impl/video_types.py index 4a8b357b3..f646504c8 100644 --- a/comfy_api/latest/_input_impl/video_types.py +++ b/comfy_api/latest/_input_impl/video_types.py @@ -89,7 +89,7 @@ class VideoFromFile(VideoInput): return stream.width, stream.height raise ValueError(f"No video stream found in file '{self.__file}'") - def get_duration(self, retrun_frames = False) -> float: + def get_duration(self) -> float: """ Returns the duration of the video in seconds. @@ -100,16 +100,14 @@ class VideoFromFile(VideoInput): self.__file.seek(0) with av.open(self.__file, mode="r") as container: if container.duration is not None: - return float(container.duration / av.time_base) if not retrun_frames\ - else float(container.duration / av.time_base), float(container.duration) + return float(container.duration / av.time_base) # Fallback: calculate from frame count and frame rate video_stream = next( (s for s in container.streams if s.type == "video"), None ) if video_stream and video_stream.frames and video_stream.average_rate: - return float(video_stream.frames / video_stream.average_rate) if not retrun_frames\ - else float(video_stream.frames / video_stream.average_rate), float(video_stream.frames) + return float(video_stream.frames / video_stream.average_rate) # Last resort: decode frames to count them if video_stream and video_stream.average_rate: @@ -119,8 +117,7 @@ class VideoFromFile(VideoInput): for _ in packet.decode(): frame_count += 1 if frame_count > 0: - return float(frame_count / video_stream.average_rate) if not retrun_frames\ - else float(frame_count / video_stream.average_rate), float(frame_count) + return float(frame_count / video_stream.average_rate) raise ValueError(f"Could not determine duration for file '{self.__file}'")