Fixing black formatting
This commit is contained in:
+41
-18
@@ -34,18 +34,18 @@ AUDIO_OFFSET_SECONDS = 1.0
|
||||
# The pause-variant entries (vftp: etc.) carry a third element "pause_narration"
|
||||
# which is a per-event property, not stored in videos.json.
|
||||
_SHORTHAND_PREFIXES: dict[str, tuple] = {
|
||||
"vft:": ("fullscreen", "above"),
|
||||
"vfb:": ("fullscreen", "below"),
|
||||
"vft:": ("fullscreen", "above"),
|
||||
"vfb:": ("fullscreen", "below"),
|
||||
"vf2t:": ("fullscreen2", "above"),
|
||||
"vf2b:": ("fullscreen2", "below"),
|
||||
"vst:": ("square", "above"),
|
||||
"vsb:": ("square", "below"),
|
||||
"vftp:": ("fullscreen", "above"),
|
||||
"vfbp:": ("fullscreen", "below"),
|
||||
"vst:": ("square", "above"),
|
||||
"vsb:": ("square", "below"),
|
||||
"vftp:": ("fullscreen", "above"),
|
||||
"vfbp:": ("fullscreen", "below"),
|
||||
"vf2tp:": ("fullscreen2", "above"),
|
||||
"vf2bp:": ("fullscreen2", "below"),
|
||||
"vstp:": ("square", "above"),
|
||||
"vsbp:": ("square", "below"),
|
||||
"vstp:": ("square", "above"),
|
||||
"vsbp:": ("square", "below"),
|
||||
}
|
||||
|
||||
|
||||
@@ -315,7 +315,9 @@ def _fuzzy_match_ratio(
|
||||
|
||||
words_to_check = min(len(phrase_words), window_size)
|
||||
# Window only needs to cover pre_filler + phrase words + inter_filler slack
|
||||
transcript_end = min(start_idx + pre_filler + words_to_check + inter_filler, len(transcription))
|
||||
transcript_end = min(
|
||||
start_idx + pre_filler + words_to_check + inter_filler, len(transcription)
|
||||
)
|
||||
|
||||
transcript_words = [
|
||||
_normalize_token(transcription[j].word)
|
||||
@@ -529,7 +531,10 @@ def align_markers_to_transcription(
|
||||
else:
|
||||
prev_idx = seen[timing.marker_id]
|
||||
prev = deduped[prev_idx]
|
||||
if prev.context == "(after previous)" and timing.context != "(after previous)":
|
||||
if (
|
||||
prev.context == "(after previous)"
|
||||
and timing.context != "(after previous)"
|
||||
):
|
||||
deduped[prev_idx] = MarkerTiming(
|
||||
marker_id=prev.marker_id,
|
||||
timestamp=timing.timestamp,
|
||||
@@ -651,16 +656,28 @@ def build_render_plan(
|
||||
# Before extracting video events, resolve any referenced videos that are missing
|
||||
# from the project's videos.json by looking them up in shared_assets/videos.json.
|
||||
_VIDEO_MARKER_PREFIXES = (
|
||||
"video:", "narration:", "vft:", "vfb:", "vf2t:", "vf2b:", "vst:", "vsb:",
|
||||
"vftp:", "vfbp:", "vf2tp:", "vf2bp:", "vstp:", "vsbp:",
|
||||
"video:",
|
||||
"narration:",
|
||||
"vft:",
|
||||
"vfb:",
|
||||
"vf2t:",
|
||||
"vf2b:",
|
||||
"vst:",
|
||||
"vsb:",
|
||||
"vftp:",
|
||||
"vfbp:",
|
||||
"vf2tp:",
|
||||
"vf2bp:",
|
||||
"vstp:",
|
||||
"vsbp:",
|
||||
)
|
||||
missing_video_ids = [
|
||||
timing.marker_id[len(prefix):]
|
||||
timing.marker_id[len(prefix) :]
|
||||
for timing in marker_timings
|
||||
if timing.timestamp >= 0
|
||||
for prefix in _VIDEO_MARKER_PREFIXES
|
||||
if timing.marker_id.startswith(prefix)
|
||||
and timing.marker_id[len(prefix):] not in videos
|
||||
and timing.marker_id[len(prefix) :] not in videos
|
||||
]
|
||||
if missing_video_ids:
|
||||
found = resolve_missing_videos(missing_video_ids, project_path, config)
|
||||
@@ -676,6 +693,7 @@ def build_render_plan(
|
||||
)
|
||||
if video_warnings:
|
||||
import sys
|
||||
|
||||
print("\nWarnings:", file=sys.stderr)
|
||||
for w in video_warnings:
|
||||
print(f" ⚠ {w}", file=sys.stderr)
|
||||
@@ -780,7 +798,10 @@ def build_render_plan(
|
||||
videos.update(found)
|
||||
still_missing = [vid_id for vid_id in config.outro if vid_id not in videos]
|
||||
for vid_id in still_missing:
|
||||
print(f" WARNING: outro video '{vid_id}' not found in videos.json or shared_assets — skipped", flush=True)
|
||||
print(
|
||||
f" WARNING: outro video '{vid_id}' not found in videos.json or shared_assets — skipped",
|
||||
flush=True,
|
||||
)
|
||||
|
||||
# Build outro events (plays after narration ends)
|
||||
outro_events = _extract_outro_events(
|
||||
@@ -997,9 +1018,11 @@ def _extract_video_events(
|
||||
mid = timing.marker_id
|
||||
|
||||
# --- shorthand markers (vft:/vfb:/vst:/vsb: and pause variants) ---
|
||||
shorthand_match = next((p for p in _SHORTHAND_PREFIXES if mid.startswith(p)), None)
|
||||
shorthand_match = next(
|
||||
(p for p in _SHORTHAND_PREFIXES if mid.startswith(p)), None
|
||||
)
|
||||
if shorthand_match:
|
||||
video_id = mid[len(shorthand_match):]
|
||||
video_id = mid[len(shorthand_match) :]
|
||||
if video_id not in videos:
|
||||
warnings.append(
|
||||
f"[{mid}] references unknown video '{video_id}' — skipped. "
|
||||
@@ -1052,7 +1075,7 @@ def _extract_video_events(
|
||||
video_markers.append((timing.timestamp, video_id, "narration", False))
|
||||
|
||||
events: list[VideoEvent] = []
|
||||
for (start_time, video_id, marker_type, pause_narration) in video_markers:
|
||||
for start_time, video_id, marker_type, pause_narration in video_markers:
|
||||
video_source = videos[video_id]
|
||||
|
||||
# Read cutout and layer directly from videos.json (projected by ETL)
|
||||
|
||||
Reference in New Issue
Block a user