Derive external timeline duration from sections
This commit is contained in:
@@ -177,11 +177,10 @@ def _build_runtime_timeline_payload(external_timeline, frame_rate: float) -> tup
|
||||
return tdata, "", "", 0.0, 0
|
||||
|
||||
sections = external_timeline.get("sections") or []
|
||||
duration_seconds = max(0.1, float(external_timeline.get("duration") or 0.0))
|
||||
duration_frames = max(1, int(round(duration_seconds * frame_rate)))
|
||||
current_start = 0
|
||||
local_prompts = []
|
||||
segment_lengths = []
|
||||
total_duration_seconds = 0.0
|
||||
|
||||
for index, section in enumerate(sections):
|
||||
if not isinstance(section, dict):
|
||||
@@ -191,6 +190,7 @@ def _build_runtime_timeline_payload(external_timeline, frame_rate: float) -> tup
|
||||
continue
|
||||
section_seconds = max(0.1, float(section.get("duration") or 0.0))
|
||||
section_frames = max(1, int(round(section_seconds * frame_rate)))
|
||||
total_duration_seconds += section_seconds
|
||||
seg = {
|
||||
"id": f"external_{index}",
|
||||
"start": current_start,
|
||||
@@ -205,6 +205,8 @@ def _build_runtime_timeline_payload(external_timeline, frame_rate: float) -> tup
|
||||
segment_lengths.append(str(section_frames))
|
||||
current_start += section_frames
|
||||
|
||||
duration_seconds = max(0.1, float(total_duration_seconds or external_timeline.get("duration") or 0.0))
|
||||
duration_frames = max(1, int(round(duration_seconds * frame_rate)))
|
||||
return tdata, " | ".join(local_prompts), ",".join(segment_lengths), duration_seconds, duration_frames
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user