Adding support for audio again

This commit is contained in:
2026-05-08 08:08:08 +02:00
parent 26d027a44e
commit f0387f24bb
3 changed files with 22 additions and 12 deletions
+1 -1
View File
@@ -2071,7 +2071,7 @@ def _print_render_plan_details(plan, marker_timings, slides: dict) -> None:
print(f" {time_str} [{marker_id}]")
elif marker_id.startswith("audio:"):
aligned_count += 1
print(f" {time_str} [audio:{marker_id[1:]}]")
print(f" {time_str} [{marker_id}]")
else:
aligned_count += 1
print(f' {marker_id:6} {time_str} "{context}"')
+18 -11
View File
@@ -142,11 +142,15 @@ def _is_known_marker(
if marker_id in CAMERA_PRESETS:
return True
# Audio markers (A followed by id)
# Audio markers (A followed by id, e.g., Awoosh) or audio: prefix (e.g., audio:woosh)
if marker_id.startswith("A") and len(marker_id) > 1:
audio_id = marker_id[1:]
if audio_id in audio or audio_id.isdigit():
return True
if marker_id.startswith("audio:") and audio is not None:
audio_id = marker_id[6:]
if audio_id in audio:
return True
return False
@@ -1014,19 +1018,22 @@ def _extract_audio_events(
continue
marker_id = timing.marker_id
audio_id = None
if marker_id.startswith("A") and len(marker_id) > 1:
audio_id = marker_id[1:]
if audio_id in audio:
if timing.timestamp < range_start or timing.timestamp >= range_end:
continue
start_time = max(0, timing.timestamp - AUDIO_OFFSET_SECONDS)
events.append(
AudioEvent(
audio_id=audio_id,
start_time=start_time,
audio_def=audio[audio_id],
)
elif marker_id.startswith("audio:"):
audio_id = marker_id[6:]
if audio_id is not None and audio_id in audio:
if timing.timestamp < range_start or timing.timestamp >= range_end:
continue
start_time = max(0, timing.timestamp - AUDIO_OFFSET_SECONDS)
events.append(
AudioEvent(
audio_id=audio_id,
start_time=start_time,
audio_def=audio[audio_id],
)
)
return events
+3
View File
@@ -57,6 +57,9 @@ def validate_project(
# Skip audio markers (start with 'A' followed by audio id, e.g., Awoosh)
if marker.startswith("A") and len(marker) > 1 and marker[1:].isalnum():
continue
# Skip audio: prefix markers (e.g., audio:woosh)
if marker.startswith("audio:"):
continue
# Validate video trigger markers — both legacy [video:xxx] and
# shorthand [vft:xxx] / [vfb:xxx] / [vst:xxx] / [vsb:xxx].
_VIDEO_PREFIXES = {