Crate anitomy[][src]

rust-anitomy

rust-anitomy is a Rust binding for Anitomy a C++ library for parsing anime video filenames.

Installation

Add this to your Cargo.toml:

[dependencies]
anitomy = "0.1"

Requirements

As this crate depends on anitomy-sys it's requirements also apply, see here for information about anitomy-sys.

Example

extern crate anitomy;

use anitomy::{Anitomy, ElementCategory};

fn main() {
    let mut anitomy = Anitomy::new();
    match anitomy.parse("[TaigaSubs]_Toradora!_(2008)_-_01v2_-_Tiger_and_Dragon_[1280x720_H.264_FLAC][1234ABCD].mkv") {
    Ok(ref elements) => {
        println!("SUCCESS: Parsed the filename successfully!");
        println!(
            "It is: {} #{} by {}",
            elements.get(ElementCategory::AnimeTitle).expect("anime title"),
            elements.get(ElementCategory::EpisodeNumber).expect("episode number"),
            elements.get(ElementCategory::ReleaseGroup).expect("release group")
        );
        println!("And extracted the following elements: {:#?}", &**elements);
    },
    Err(ref elements) => {
        println!("ERROR: Couldn't parse the filename successfully!");
        println!("But we managed to extract these elements: {:#?}", &**elements);
    },
  }
}

Structs

Anitomy

An Anitomy parser instance.

Element

An element parsed from a filename by Anitomy.

Elements

Collection of Element instances parsed from a filename, as a result of calling Anitomy.parse.

Options

The options used by Anitomy to determine how to parse a filename.

Enums

ElementCategory

The category of an Element.