rsubs-lib

ci clippy Crates.io Crates.io CodeCoverage

A rust library for converting and changing subtitles Currently a work in progress but it should be able to produce usable .srt,.vtt and .ssa/ass files from one another.

Usage:

```rust use rsubslib::srt; use rsubslib::ssa; use rsubslib::vtt; use rsubslib::Subtitle; use std::str::FromStr;

fn main() { srt::parse("./tests/fixtures/test.srt".tostring()) .unwrap() // Can read either a file or a string .tovtt() // converts file to WEBVTT .tofile("./tests/fixtures/test1.vtt") // Writes the converted subtitle to a file .unwrap(); vtt::parse("./tests/fixtures/test.vtt") .unwrap() .toass() // converts file to SSA/ASS .tofile("./tests/fixtures/test1.ass") .unwrap(); ssa::parse("./tests/fixtures/test.ass".tostring()) .unwrap() .tosrt() // converts file to SRT .tofile("./tests/fixtures/test1.srt") .unwrap(); // OR Using the simpler Subtitle enum let sub: vtt::VTTFile = Subtitle::fromstr("./tests/fixtures/test.ass").unwrap().into(); sub.to_file("./tests/fixtures/test.vtt").unwrap(); } ```

More examples are provided in the examples folder.

Current features: