2.0 KiB
2.0 KiB
Speaking Lab Subtitle Delete Cues Design
Goal
Allow an admin to delete problematic subtitle cue blocks from an already uploaded material without editing cue text or timestamps.
Scope
Included:
- Add subtitle cue deletion UI in the existing admin edit flow.
- Support English and Chinese subtitle tracks independently.
- Delete whole cue blocks only.
- Save updated subtitle content through the existing material update request.
- Keep existing subtitle file replacement support.
Excluded:
- Editing subtitle text.
- Editing timestamps.
- Reordering subtitle cues.
- Deleting video materials.
- Study page subtitle editing.
- README changes.
Backend
Extend PATCH /api/videos/{video_id} with optional form fields:
subtitle_en_contentsubtitle_zh_content
When those fields are provided and no replacement upload is provided for that language, update the corresponding subtitle row content in SQLite.
Existing uploaded subtitle file paths can stay unchanged because this local prototype reads subtitle content from the database response.
Admin UI
When an admin clicks 编辑 on a material:
- Show an English subtitle deletion section if the material has English subtitle content.
- Show a Chinese subtitle deletion section if the material has Chinese subtitle content.
- Each cue shows time range and text.
- Each cue has a
删除button. - Deleted cues disappear from the list immediately.
- Saving the material submits the remaining subtitle content.
When the admin cancels editing or starts editing another material, subtitle deletion state resets.
Testing
Run:
python -m py_compile backend\main.py backend\db.py
node --check admin.js
node --check app.js
node --check home.js
node tests\admin-file-input.test.mjs
node tests\progress-helpers.test.mjs
Manual checks:
- Log in as admin and open
admin.html. - Edit a material with subtitles.
- Delete one subtitle cue.
- Save.
- Reopen the material in study page and confirm the deleted cue is gone.