Fixing gnommo

This commit is contained in:
2026-03-26 10:46:05 +01:00
parent 0e22fcfbb3
commit 7c75610fce
15 changed files with 2028 additions and 410 deletions
+19 -8
View File
@@ -57,16 +57,26 @@ 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
# Validate video trigger markers (video:xxx) - slide-like videos
if marker.startswith("video:"):
video_id = marker[6:] # Remove 'video:' prefix
# Validate video trigger markers — both legacy [video:xxx] and
# shorthand [vft:xxx] / [vfb:xxx] / [vst:xxx] / [vsb:xxx].
_VIDEO_PREFIXES = {
"video:": 6,
"vft:": 4,
"vfb:": 4,
"vst:": 4,
"vsb:": 4,
}
matched_prefix = next(
(p for p in _VIDEO_PREFIXES if marker.startswith(p)), None
)
if matched_prefix is not None:
video_id = marker[_VIDEO_PREFIXES[matched_prefix] :]
if video_id not in videos:
# Check if it's a file extension mismatch
hint = ""
if "." in video_id:
base_name = video_id.rsplit(".", 1)[0]
if base_name in videos:
hint = f" (Did you mean [video:{base_name}]? Don't include file extensions in markers)"
hint = f" (Did you mean [{matched_prefix}{base_name}]? Don't include file extensions in markers)"
warnings.append(
ValidationIssue(
f"Video marker [{marker}] referenced in manuscript but '{video_id}' not defined in videos.json{hint} — using PlaceholderVideo instead",
@@ -214,11 +224,12 @@ def validate_project(
)
)
# Check we have at least one video source
if not videos:
# Check videos.json exists (empty is fine — project may not need triggered videos)
if not (project_path / config.videos_path).exists():
issues.append(
ValidationIssue(
"No video sources defined in videos.json", project_path / "videos.json"
"videos.json not found — run 'gnommo import' to create it",
project_path / "videos.json",
)
)