Expand description
Media types for subtitle and transcript support.
Provides SRT and VTT subtitle parsing with timestamp preservation.
No additional dependencies — uses only std and serde.
§Example
use aprender_rag::media::{parse_subtitles, SubtitleFormat};
let srt = "1\n00:00:01,000 --> 00:00:04,500\nHello world.\n";
let track = parse_subtitles(srt).unwrap();
assert_eq!(track.format, SubtitleFormat::Srt);
assert_eq!(track.cues.len(), 1);
assert!((track.cues[0].start_secs - 1.0).abs() < 0.01);Structs§
- Subtitle
Cue - A single timed text cue from a subtitle file.
- Subtitle
Track - Parsed subtitle file.
Enums§
- Subtitle
Format - Subtitle file format.
Functions§
- format_
display_ time - Format seconds as display timestamp
MM:SSorH:MM:SS. - parse_
subtitles - Parse SRT or VTT from a string, auto-detecting format.