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: re-recorded narration reuses its freed media name instead of growing a suffix each round; round-trip import no longer writes the Generate-only notes/total.md

hugohe3b560f85b305c
diff --git a/skills/ppt-master/scripts/pptx_to_svg/converter.py b/skills/ppt-master/scripts/pptx_to_svg/converter.py
index 083a6512..aff682a8 100644
--- a/skills/ppt-master/scripts/pptx_to_svg/converter.py
+++ b/skills/ppt-master/scripts/pptx_to_svg/converter.py
@@ -1455,7 +1455,7 @@ def _write_artifact_tree(
_collect_media(art.media_files)
_write_animation_config(output_dir, result)
- _write_speaker_notes(output_dir, result)
+ _write_speaker_notes(output_dir, result, write_total=not options.roundtrip)
if result.native_structure is not None:
if result.source_pptx_path is None:
raise RuntimeError(
@@ -1568,7 +1568,12 @@ def _sha256_file(path: Path) -> str:
return digest.hexdigest()
-def _write_speaker_notes(output_dir: Path, result: ConvertResult) -> None:
+def _write_speaker_notes(
+ output_dir: Path,
+ result: ConvertResult,
+ *,
+ write_total: bool = True,
+) -> None:
"""Write imported notes into the standard per-slide Markdown contract."""
if not result.speaker_notes:
return
@@ -1584,6 +1589,10 @@ def _write_speaker_notes(output_dir: Path, result: ConvertResult) -> None:
"",
note.markdown.strip(),
])
+ if not write_total:
+ # Round-trip notes are keyed by output stem; the Generate-only
+ # total.md would only pose as a second source of truth.
+ return
(notes_dir / "total.md").write_text(
"\n".join(combined).rstrip() + "\n",
encoding="utf-8",
@@ -1727,14 +1736,7 @@ def _write_roundtrip_manifest(
"sha256": _sha256_file(animation_path),
"baseline": result.animation_config,
},
- "notesTotal": (
- {
- "file": "notes/total.md",
- "sha256": _sha256_file(output_dir / "notes/total.md"),
- }
- if result.speaker_notes
- else None
- ),
+ "notesTotal": None,
},
"directories": {
"authoringSvg": AUTHORING_SVG_FLAT_DIR.as_posix(),
@@ -1829,7 +1831,11 @@ def _write_conversion_report(
"notes": [
(Path("notes") / note.filename).as_posix()
for note in result.speaker_notes
- ] + (["notes/total.md"] if result.speaker_notes else []),
+ ] + (
+ ["notes/total.md"]
+ if result.speaker_notes and not options.roundtrip
+ else []
+ ),
}
if embedded_font_paths:
artifacts["embeddedFontManifest"] = embedded_font_paths[-1]
diff --git a/skills/ppt-master/scripts/svg_to_pptx/pptx_package/builder.py b/skills/ppt-master/scripts/svg_to_pptx/pptx_package/builder.py
index 776ecaee..1445a966 100644
--- a/skills/ppt-master/scripts/svg_to_pptx/pptx_package/builder.py
+++ b/skills/ppt-master/scripts/svg_to_pptx/pptx_package/builder.py
@@ -1884,6 +1884,19 @@ def _remove_relationships_by_type(rels_path: Path, rel_type: str) -> int:
return removed
+def _part_has_relationship_references(extract_dir: Path, part_name: str) -> bool:
+ """Return whether any relationships file in the package still targets a part."""
+ for rels_path in (extract_dir / 'ppt').rglob('*.rels'):
+ source_part = _part_name_for_relationships_path(rels_path)
+ for attrs in _read_relationships(rels_path).values():
+ if attrs.get('TargetMode') == 'External':
+ continue
+ target = attrs.get('Target')
+ if target and _resolve_package_target(source_part, target) == part_name:
+ return True
+ return False
+
+
def _unused_part_path(directory: Path, filename: str) -> Path:
"""Allocate a part name without overwriting any existing package member."""
requested = Path(filename)
@@ -7968,6 +7981,20 @@ def create_pptx_with_native_svg(
f'ppt/slides/slide{slide_num}.xml', relationship['Target'],
))
_remove_relationship(rels_path, rel_id)
+ requested_media = media_dir / f'narration{slide_num}{ext}'
+ if (
+ requested_media.exists()
+ and requested_media.relative_to(extract_dir).as_posix()
+ in replaced_narration_parts
+ and not _part_has_relationship_references(
+ extract_dir,
+ requested_media.relative_to(extract_dir).as_posix(),
+ )
+ ):
+ # The earlier PPT Master narration for this slide was
+ # just unlinked; reuse its name instead of growing a
+ # `_1`, `_1_1`, ... suffix with every re-recording.
+ requested_media.unlink()
media_name = _unused_part_path(media_dir, f'narration{slide_num}{ext}').name
shutil.copy2(audio_path, media_dir / media_name)
audio_exts_used.add(ext)
diff --git a/skills/ppt-master/scripts/tests/test_edit_native_batch_a.py b/skills/ppt-master/scripts/tests/test_edit_native_batch_a.py
index 0875db18..442d52c8 100644
--- a/skills/ppt-master/scripts/tests/test_edit_native_batch_a.py
+++ b/skills/ppt-master/scripts/tests/test_edit_native_batch_a.py
@@ -231,7 +231,14 @@ class EditNativeBatchATests(unittest.TestCase):
)
repeated, *_ = self._export(imported, '--recorded-narration', 'audio')
with zipfile.ZipFile(repeated) as archive:
- self.assertNotIn('ppt/media/narration1.wav', archive.namelist())
+ # The earlier narration part is replaced in place: one narration
+ # media part, carrying the replacement bytes, no `_1` suffix growth.
+ narration_parts = [
+ name for name in archive.namelist()
+ if name.startswith('ppt/media/narration') and name.endswith('.wav')
+ ]
+ self.assertEqual(narration_parts, ['ppt/media/narration1.wav'])
+ self.assertEqual(archive.read('ppt/media/narration1.wav'), replacement.read_bytes())
self.assertEqual(len(self._slide(repeated).findall('.//p:audio', NS)), 1)
def test_a5_full_overlay_preserves_advance_and_explicit_advance_wins(self) -> None: