Expand description
Subtitle file formats: SubRip (.srt) and WebVTT (.vtt) โ parse (auto-detected) and write. Basic formatting tags (, , {\an8}, VTT cue settings) are stripped on import; text is kept as plain lines. Times are seconds.
Functionsยง
- fmt_
time ๐ - parse
- Parse SRT or WebVTT (auto-detected by the โWEBVTTโ header / timestamp style). Malformed blocks are skipped. Returns (start, end, text) triples in file order.
- parse_
block ๐ - One blank-line separated block: [optional index / cue-id lines,] timestamp line, text lines. The timestamp line is the first containing โโ>โ (this also skips WEBVTT/NOTE/STYLE blocks).
- parse_
time ๐ - โHH:MM:SS,mmmโ / โHH:MM:SS.mmmโ / โMM:SS.mmmโ โ seconds.
- strip_
tags ๐ - Append
stooutwith<...>tags and{\...}override codes removed. - to_srt
- to_vtt