Expand description
§rsubs-lib
This crate provides a simple way for parsing, modifying or converting
subtitle files such as .srt
,.ssa
,.ass
and .vtt
.
Example usage:
use std::ops::Add;
use std::time::Duration;
use rsubs_lib::SRT;
let raw_srt = r#"1
00:00:00,000 --> 00:00:02,000
This is a example .srt file
2
00:00:02,000 --> 00:00:06,000
The following code will delay the subtitles by one second
"#;
let mut srt = SRT::parse(raw_srt).unwrap();
for line in &mut srt.lines {
line.start.add(Duration::from_secs(1));
line.end.add(Duration::from_secs(1));
}
println!("{}", srt)
Modules§
- Helper module that provides color and timestamp structs and functions for modifying subtitles.
Structs§
- Contains a Vec<SRTLine>
- Describes each line
- Contains the styles, events and info as well as a format mentioning whether it’s
.ass
or.ssa
- Describes each individual element of an
Event
line in the.ass
format - SSAInfo contains headers and general information about the script.
- The VTTLine contains information about the line itself as well as the positional information of the line
- The VTTStyle contains information that generally composes the
::cue
header