pub fn parse(path_or_content: String) -> Result<SRTFile, Error>Expand description
Examples found in repository?
examples/shift_srt_by_1s.rs (line 10)
8 9 10 11 12 13 14 15 16 17 18 19 20 21
fn main() {
let mut srt =
rsubs_lib::srt::parse("tests/fixtures/test.srt".to_string()).expect("failed parsing");
for line in srt.lines.iter_mut() {
line.line_end += 20;
line.line_start += 50;
line.line_text.push_str(" Ipsum");
}
println!("{srt}");
let s = Subtitle::from_str("tests/fixtures/test.srt").unwrap();
let a: SSAFile = s.clone().into(); //convert to `.ass` and then back to `.srt`
assert_eq!(format!("{}", a.to_srt()), format!("{s}"));
}