@@ -732,7 +732,12 @@ def _check_timing_sync(self, seg_id: str) -> CheckResult:
732732 return CheckResult ("timing_sync" , True , ["Audio is an LFS pointer (skipped)" ])
733733
734734 is_manim = self .config .visual_map .get (seg_id , {}).get ("type" ) == "manim"
735- block = self ._load_timing_block (seg_id )
735+ from docgen .timestamps import TimestampError
736+
737+ try :
738+ block = self ._load_timing_block (seg_id )
739+ except TimestampError as exc :
740+ return CheckResult ("timing_sync" , False , [str (exc )])
736741 if block is None :
737742 if is_manim :
738743 return CheckResult (
@@ -811,7 +816,12 @@ def _check_story_end(self, seg_id: str) -> CheckResult:
811816 "story_end" , True , ["No animations/specs/*.scene.yaml (skipped)" ]
812817 )
813818
814- block = self ._load_timing_block (seg_id )
819+ from docgen .timestamps import TimestampError
820+
821+ try :
822+ block = self ._load_timing_block (seg_id )
823+ except TimestampError as exc :
824+ return CheckResult ("story_end" , False , [str (exc )])
815825 words = block .get ("words" ) if isinstance (block , dict ) else None
816826 words_ok = isinstance (words , list ) and bool (words )
817827
@@ -905,7 +915,12 @@ def _check_av_sync(self, seg_id: str, rec: Path) -> CheckResult:
905915 except Exception :
906916 return CheckResult ("av_sync" , True , ["tesseract binary not installed (skipped)" ])
907917
908- block = self ._load_timing_block (seg_id )
918+ from docgen .timestamps import TimestampError
919+
920+ try :
921+ block = self ._load_timing_block (seg_id )
922+ except TimestampError as exc :
923+ return CheckResult ("av_sync" , False , [str (exc )])
909924 if block is None :
910925 return CheckResult (
911926 "av_sync" , True , ["No timing.json entry (skipped) — run `docgen timestamps`" ]
@@ -927,13 +942,9 @@ def _check_av_sync(self, seg_id: str, rec: Path) -> CheckResult:
927942
928943 def _load_timing_block (self , seg_id : str ) -> dict [str , Any ] | None :
929944 """One segment's block from ``animations/timing.json`` (keyed by narration stem)."""
930- timing_path = self .config .animations_dir / "timing.json"
931- if not timing_path .is_file ():
932- return None
933- try :
934- data = json .loads (timing_path .read_text (encoding = "utf-8" ))
935- except (OSError , json .JSONDecodeError ):
936- return None
945+ from docgen .timestamps import load_bundle_timing
946+
947+ data = load_bundle_timing (self .config )
937948 stem = self .config .resolve_segment_name (seg_id )
938949 block = data .get (stem )
939950 if not isinstance (block , dict ):
0 commit comments