feat(gui): implement GUI edit mode with atomic clip operations
Phase 2 complete - GUI editing layer on top of Phase 1 CLI: Config: - config.py now only has API keys (API_KEY, API_HOST, PYTHON, CLI_DIR) - Project paths (video_src, ppt_path, max_total_duration) in generated_config.yaml Atomic clip operations (Pipeline methods): - reextract_clip(clip_index, new_title) - re-match title in transcript - delete_clip(clip_index) - remove clip and its intermediate files - add_clip_by_title(new_title) - match new title, handle overlaps - reburn_titles() - re-burn title track from updated clips - reburn_subtitles(user_texts) - burn user-edited subtitles directly - _find_title_in_transcript() - substring match in corrected transcript GUI: - Two startup modes: new project / open existing project - Clip list with double-click rename, right-click delete, + add - Subtitle preview with direct text editing - Apply button orchestrates reburn_titles/reburn_subtitles - Unmatched clips shown with warning label, excluded from burn CLI/GUI interoperability: - Both use same generated_config.yaml as single source of truth - CLI: run.bat for full pipeline, burn.bat for quick reburn - GUI: open project dir, edit, apply Docs: - USAGE.md updated with GUI edit mode documentation
This commit is contained in:
@@ -115,3 +115,71 @@ A: 直接改 `v1_title.srt` 里的时间轴,或者改 `generated_config.yaml`
|
||||
|
||||
**Q: 想删掉某个 clip?**
|
||||
A: 从 `generated_config.yaml` 里删掉那一条,然后删对应 `intermediates/clip*.json` 和 `clip*.mp4`,最后 `run.bat`。
|
||||
|
||||
## GUI 编辑模式
|
||||
|
||||
### 启动方式
|
||||
|
||||
GUI 支持两种启动模式:
|
||||
|
||||
**方式一:新建项目**
|
||||
```bash
|
||||
python src/main.py
|
||||
# 或双击 start.bat
|
||||
```
|
||||
在启动页选择"新建项目",选择视频+PPT,运行完整流程。
|
||||
|
||||
**方式二:打开已有项目**
|
||||
在启动页选择"打开已有项目",选择 output 目录。
|
||||
项目文件 `generated_config.yaml` 包含所有项目信息(视频路径、PPT路径、知识点列表)。
|
||||
|
||||
### 编辑知识点
|
||||
|
||||
打开项目后进入编辑界面:
|
||||
|
||||
- **改标题**:双击 clip 列表中的任意条目,输入新标题 → 系统自动在 transcript 中重新匹配时间段 → 处理重叠
|
||||
- **删 clip**:右键点击 clip → 删除此 Clip
|
||||
- **新增知识点**:点击"+ 新增知识点"按钮,输入标题 → 系统在 transcript 中匹配 → 如有重叠自动合并
|
||||
|
||||
> 注意:匹配不到的 clip 显示红色背景的"未匹配"标签,不参与最终烧录
|
||||
|
||||
### 编辑字幕
|
||||
|
||||
右侧字幕预览区显示 `v1_content.srt` 内容,可直接编辑文本。
|
||||
|
||||
### 应用更改
|
||||
|
||||
点击"应用"按钮:
|
||||
1. 检测字幕是否有修改 → 有则重烧字幕轨
|
||||
2. 检测 clips 是否有修改 → 重烧标题轨
|
||||
3. 自动合并+烧录最终视频
|
||||
|
||||
### 文件结构
|
||||
|
||||
```
|
||||
output_dir/
|
||||
├── generated_config.yaml ← 项目文件(GUI 编辑后同步更新)
|
||||
├── intermediates/ ← 中间缓存
|
||||
│ ├── clip*.json ← Whisper 转录(删后可重新生成)
|
||||
│ ├── clip*.mp4 ← 视频片段
|
||||
│ └── corrected_transcript.json ← LLM校正后的全量转录
|
||||
├── subs/
|
||||
│ ├── v1_title.srt ← 标题轨
|
||||
│ └── v1_content.srt ← 字幕轨(可直接编辑)
|
||||
└── final.mp4 ← 最终输出
|
||||
```
|
||||
|
||||
## CLI/GUI 互操作
|
||||
|
||||
CLI 和 GUI 共用同一套项目文件体系:
|
||||
|
||||
```bash
|
||||
# 1. CLI 批量处理
|
||||
run.bat
|
||||
|
||||
# 2. GUI 审核修改
|
||||
python src/main.py
|
||||
# → 选择"打开已有项目" → 选择同一 output_dir
|
||||
```
|
||||
|
||||
修改后点"应用",GUI 自动判断需要重生成哪些部分。
|
||||
|
||||
Reference in New Issue
Block a user