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§
- util
- Helper module that provides color and timestamp structs and functions for modifying subtitles.
Structs§
- SRT
- Contains a Vec<SRTLine>
- SRTError
- SRTLine
- Describes each line
- SSA
- Contains the styles, events and info as well as a format mentioning whether it’s
.ass
or.ssa
- SSAError
- SSAEvent
- Describes each individual element of an
Event
line in the.ass
format - SSAInfo
- SSAInfo contains headers and general information about the script.
- SSAStyle
- SSAStyle describes each part of the
Format:
side of a.ssa
or.ass
subtitle. - VTT
- Contains VTTStyles and VTTLines
- VTTError
- VTTLine
- The VTTLine contains information about the line itself as well as the positional information of the line
- VTTRegion
- VTTStyle
- The VTTStyle contains information that generally composes the
::cue
header