#anime #filenames #bindings #parser #anitomy

sys anitomy-sys

Bindings for Anitomy, the library for parsing anime video filenames

4 releases

Uses old Rust 2015

0.2.0 Nov 17, 2023
0.1.2 Dec 30, 2018
0.1.1 Jun 17, 2018
0.1.0 Jun 17, 2018

#2526 in Parser implementations

Download history 10/week @ 2024-07-20 24/week @ 2024-07-27 8/week @ 2024-08-03 11/week @ 2024-08-10 10/week @ 2024-08-17 11/week @ 2024-08-24 21/week @ 2024-08-31 9/week @ 2024-09-07 17/week @ 2024-09-14 31/week @ 2024-09-21 21/week @ 2024-09-28 8/week @ 2024-10-05 15/week @ 2024-10-12 14/week @ 2024-10-19 7/week @ 2024-10-26 22/week @ 2024-11-02

58 downloads per month
Used in anitomy

MPL-2.0 license

125KB
2.5K SLoC

C++ 1.5K SLoC // 0.1% comments Rust 1K SLoC C 101 SLoC // 0.1% comments

anitomy-sys

crates.io docs.rs Linux & OSX Build Status License
anitomy-sys is a low-level Rust binding for Anitomy a C++ library for parsing anime video filenames.

Makes use of anitomy-c a C ABI wrapper for Anitomy.

Installation

Add this to your Cargo.toml:

[dependencies]
anitomy-sys = "0.1"

anitomy-sys will compile and statically link anitomy-c and Anitomy at build time, as such a compatible compiler is required.

Requirements

Example

extern crate anitomy_sys;

use anitomy_sys::{Anitomy, ElementCategory};
use std::ffi::CString;

fn main() {
    let mut anitomy = unsafe { Anitomy::new() };
    let filename = CString::new("[TaigaSubs]_Toradora!_(2008)_-_01v2_-_Tiger_and_Dragon_[1280x720_H.264_FLAC][1234ABCD].mkv").expect("no nul chars in filename");
    let success = unsafe { anitomy.parse(&filename) };
    println!("Success? {}", success);
    unsafe {
        let elements = anitomy.elements();
        println!(
            "It is: {} #{} by {}",
            elements.get(ElementCategory::AnimeTitle),
            elements.get(ElementCategory::EpisodeNumber),
            elements.get(ElementCategory::ReleaseGroup)
        );
        (0..elements.count(None))
            .flat_map(|i| elements.at(i))
            .for_each(|e| println!("{:?}: {:?}", e.category, e.value));
    }
    unsafe { anitomy.destroy() };
}

Which outputs:

Success? true
It is: Toradora! #01 by TaigaSubs
FileExtension: "mkv"
FileName: "[TaigaSubs]_Toradora!_(2008)_-_01v2_-_Tiger_and_Dragon_[1280x720_H.264_FLAC][1234ABCD]"
VideoTerm: "H.264"
VideoResolution: "1280x720"
AudioTerm: "FLAC"
FileChecksum: "1234ABCD"
AnimeYear: "2008"
EpisodeNumber: "01"
ReleaseVersion: "2"
AnimeTitle: "Toradora!"
ReleaseGroup: "TaigaSubs"
EpisodeTitle: "Tiger and Dragon"

No runtime deps

~0–280KB