Files
lingo/scripts/README.md
T
ilaandClaude Opus 4.8 6091c441cd chore: 加入 episodes.json 校验与修正脚本
- scripts/validate_episodes.py:结构/字段/时间戳/音频对账等校验
- scripts/fix_episodes.py:重算统计字段、引号归一、去空白(自动备份)
- scripts/README.md:用法与已知数据缺口说明

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 15:16:59 +08:00

32 lines
1.3 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# scripts/
维护内容数据 `family-album-usa/episodes.json` 的工具脚本(纯 Python 标准库,无需安装依赖)。
## validate_episodes.py — 数据校验(只读)
把人工体检固化为可重复检查:结构/字段一致性、`lineCount` 自洽、统计字段是否准确、时间戳单调性、音频对账(引用 vs 磁盘)、说话人前缀与引号风格提示。
```bash
python3 scripts/validate_episodes.py # 默认数据路径
python3 scripts/validate_episodes.py 某/episodes.json
```
发现 `ERROR` 退出码为 1,可接入 CI / pre-commit。
## fix_episodes.py — 格式修正(会先备份)
只做安全可逆的修正:重算统计字段、弯引号统一为直引号、去 `en` 首尾空白。
**不**剥离说话人前缀、**不**改时间戳数值、**不**为无音频集补造数据(这些需补料后另行处理,详见 `docs/04-architecture.md`)。
```bash
python3 scripts/fix_episodes.py --dry-run # 预览将改什么
python3 scripts/fix_episodes.py # 就地修正,自动备份 .bak
```
## 已知数据缺口(背景)
- ep18–26 共 9 集**无音频**,ep18/19 转写为剧本格式(含说话人前缀)——需补原始音频后再处理。
- ep1/ep12 各缺 1 幕音频;`audio/episode12_act2.mp3` 为游离文件。
MVP 建议先锁定 ep1–17。