Repository navigation
feat(subtitles): add cue builder and srt/vtt renderers - #10
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Task T1.4 from
docs/ARCHITECTURE.md§14 (refs §7.6, §8.2).What changed
src/tts/subtitles/cues.py:build_cues(words, sentences, audio_duration_ms)— sentence grouping, 84-char / 5 s splits, 1.2 s minimum extension capped at the next cue start, last-cue clamp to audio duration.src/tts/subtitles/srt.py/vtt.py:render_srt/render_vttwith SRTHH:MM:SS,mmmand WebVTTHH:MM:SS.mmmoutput..srt/.vttgolden fixtures;.gitattributespins the fixtures to LF.Verification
python -m pytest tests/unit -q --basetemp .venv/ptmp-t14-all→ 87 passed (66 baseline + 21 new)ruff check src/tts tests→ All checks passedruff format --check src/tts tests→ 26 files already formattedmypy --strict src/tts→ Success, no issues in 22 source filesgit diff --check→ cleangit check-attrreportseol: lfDecisions (frozen downstream, also in
docs/TASKS.mdNotes)subtitles/__init__.pyadded; cue text is word texts joined with one space (the interface has no source text); a single oversized word is never split.frontend/src/api/mock.tsformat, including a single trailing newline; empty SRT →"", empty VTT →"WEBVTT\n\n".frontend/src/api/mock.ts:buildCueslacks sentence grouping, the 1.2 s floor, and the audio cap; T4.1 should align it withtts.subtitles.cues.(char_start, char_end, first_word_idx)triplets indexed into the final word list; empty sentences are skipped.Next task: T1.5 (history DAL completion), after this PR is merged.