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
+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