ass_parser 0.1.0

A parser for editing creating and saving .ass files.
Documentation
ass_parser-0.1.0 has been yanked.

AssParser

ass_parser is a crate to parse .ass (Advanced SubStation Alpha) files. which is a subtitle file for creating and displaying subtitles in video files. It is widely used due to it's complex text formatting, positioning and styling. The Advanced SubStation Alpha is a successor to the SubStation Alpha .ssa file.

Installation

Add ass_parser as a dependency to your cargo.toml:

cargo add ass_parser

Introduction

AssParser is based on the principle of easy to read write and modify .ass files. This is the first version of ass_parserand now currently only have the features to modify .ass file.

Example

Modifying a .ass subtitle file.

use hex_color::HexColor;
use ass_parser;
use ass_parser::{AssFile, V4Format, AssFileOptions};


fn main() {
   let mut ass_file = ass_parser::AssFile::from_file("subtitles.ass".to_string());
   let color  = AssFileOptions::get_ass_color(HexColor::YELLOW);
   ass_file.components.script 
       .set_scripttype("v4.00+".to_string())
       .set_playresx("384".to_string())
       .set_playresy("288".to_string())
       .set_scaledborderandshadow("yes".to_string())
       .set_ycbcr_matrix("None".to_string());

   ass_file.components.v4.set_v4(V4Format::default());

   AssFile::save_file(&ass_file, "modified_subtitles.ass");
}