Adding fix to aligner
This commit is contained in:
+10
-8
@@ -744,12 +744,14 @@ def _generate_slides_json(directory: Path, verbose: bool) -> None:
|
||||
# Sort by slide number
|
||||
sorted_slides = dict(sorted(slides.items(), key=lambda x: int(x[0][1:])))
|
||||
|
||||
# Write slides.json
|
||||
# Write slides.json only if content changed
|
||||
output_path = directory / "slides.json"
|
||||
with open(output_path, "w", encoding="utf-8") as f:
|
||||
json.dump(sorted_slides, f, indent=2)
|
||||
|
||||
print(f" Generated {output_path} ({len(sorted_slides)} slides)")
|
||||
new_content = json.dumps(sorted_slides, indent=2)
|
||||
existing_content = output_path.read_text(encoding="utf-8") if output_path.exists() else None
|
||||
if new_content != existing_content:
|
||||
with open(output_path, "w", encoding="utf-8") as f:
|
||||
f.write(new_content)
|
||||
print(f" Generated {output_path} ({len(sorted_slides)} slides)")
|
||||
if verbose:
|
||||
for slide_id in sorted_slides:
|
||||
print(f" [{slide_id}]")
|
||||
@@ -950,9 +952,9 @@ def _import_narration_segments(narration_dir: Path, config, verbose: bool) -> No
|
||||
added_count += 1
|
||||
print(f" Added narration segment: {segment_id} (from raw_mov)")
|
||||
|
||||
# Always write narration.json (creates it if missing)
|
||||
with open(narration_json_path, "w", encoding="utf-8") as f:
|
||||
json.dump(existing_narration, f, indent=2)
|
||||
if added_count > 0 or not narration_json_path.exists():
|
||||
with open(narration_json_path, "w", encoding="utf-8") as f:
|
||||
json.dump(existing_narration, f, indent=2)
|
||||
|
||||
if added_count > 0:
|
||||
print(f" Updated narration.json (+{added_count} segments)")
|
||||
|
||||
Reference in New Issue
Block a user