Repository navigation
Add SRT (.srt) subtitle converter - #2677
Open
Bicheng (Kenneth) (BichengWang) wants to merge 1 commit into
Open
Bicheng (Kenneth) (BichengWang) wants to merge 1 commit into
Bicheng (Kenneth) (BichengWang) wants to merge 1 commit into
Conversation
Convert .srt files to a transcript with one '[HH:MM:SS] text' line per cue,
dropping cue numbers, millisecond timings and styling tags (<i>, <b>, <u>,
<font>, {\an8}). A cue runs from its timing line to the next one, so blank
lines inside a cue or a missing separator do not lose text. Text that only
looks like markup (<Bob>, x<y) is kept, and a .srt with no cues is left to the
plain-text converter.
Author
|
Hello members, is there any one can help additional review? Thank you! |
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.
SRT files currently go through the plain-text converter, so the output keeps cue numbers, millisecond timing arrows and styling tags, which is noisy for an LLM reader.
This adds
SrtConverter, which turns each cue into one line prefixed with its start time:<i>,<b>,<u>,<font>and{\an8}styling are dropped. Other angle brackets (<Bob>,x<y) are kept.asciiguessed from the first 64 KiB), it falls back to a whole-file guess..srtwith no cues raises, so the plain-text converter still handles it..srt,text/srt,text/x-srtandapplication/x-subrip.No new dependencies. Tests are in
tests/test_srt.py, and the full suite passes locally.