Skip to content

AI turns documents or topics into real, native PowerPoint decks—with native shapes, transitions and animations, data-backed charts and tables on demand, audio narration from speaker notes, and support for your own .pptx templates. · by Hugo He

fix(narration): enforce safe dependency migration and audio matching

hugohe33117e4379639
diff --git a/skills/ppt-master/scripts/native_enhance_pptx_core.py b/skills/ppt-master/scripts/native_enhance_pptx_core.py
index bc97f6f5..dfe3753f 100644
--- a/skills/ppt-master/scripts/native_enhance_pptx_core.py
+++ b/skills/ppt-master/scripts/native_enhance_pptx_core.py
@@ -1386,7 +1386,11 @@ def _resolve_slide_enter(
)
-def _validate_plan_modules(plan: dict) -> None:
+def _validate_plan_modules(
+ plan: dict,
+ *,
+ allow_legacy_audio_without_notes: bool = False,
+) -> None:
if plan and plan.get("schema") != PLAN_SCHEMA:
raise ValueError(
f"unsupported enhancement plan schema: {plan.get('schema')!r}"
@@ -1432,9 +1436,15 @@ def _validate_plan_modules(plan: dict) -> None:
)
notes_config = modules_cfg.get("notes")
audio_config = modules_cfg.get("audio")
+ legacy_audio_without_notes = (
+ allow_legacy_audio_without_notes
+ and isinstance(notes_config, dict)
+ and notes_config.get("enabled") is False
+ )
if (
isinstance(audio_config, dict)
and audio_config.get("enabled") is True
+ and not legacy_audio_without_notes
and (
not isinstance(notes_config, dict)
or notes_config.get("enabled") is not True
@@ -1784,7 +1794,10 @@ def plan_project(args: argparse.Namespace) -> int:
existing_plan = _load_enhancement_plan(project_path)
try:
- _validate_plan_modules(existing_plan)
+ _validate_plan_modules(
+ existing_plan,
+ allow_legacy_audio_without_notes=True,
+ )
readiness = _collect_material_readiness(
slides,
notes_dir,
diff --git a/skills/ppt-master/scripts/svg_to_pptx/pptx_package/narration.py b/skills/ppt-master/scripts/svg_to_pptx/pptx_package/narration.py
index e9e0503f..58ccdd22 100644
--- a/skills/ppt-master/scripts/svg_to_pptx/pptx_package/narration.py
+++ b/skills/ppt-master/scripts/svg_to_pptx/pptx_package/narration.py
@@ -103,6 +103,7 @@ def find_narration_files(audio_dir: Path, svg_files: list[Path]) -> dict[str, Pa
numbered.setdefault(number, []).append(path)
matched: dict[str, Path] = {}
+ claimed_by: dict[Path, str] = {}
for index, svg in enumerate(svg_files, 1):
stem = svg.stem
candidates = exact.get(stem)
@@ -118,7 +119,16 @@ def find_narration_files(audio_dir: Path, svg_files: list[Path]) -> dict[str, Pa
f"multiple narration audio files match slide {stem!r}: "
f"{names}; keep exactly one supported file for this slide"
)
- matched[stem] = candidates[0]
+ candidate = candidates[0]
+ previous_stem = claimed_by.get(candidate)
+ if previous_stem is not None:
+ raise ValueError(
+ f"narration audio file {candidate.name!r} matches multiple slides: "
+ f"{previous_stem!r}, {stem!r}; provide one distinct audio file "
+ "per slide"
+ )
+ matched[stem] = candidate
+ claimed_by[candidate] = stem
return matched