4个版本
使用旧的Rust 2015
0.2.0 | 2023年11月17日 |
---|---|
0.1.2 | 2018年12月30日 |
0.1.1 | 2018年6月17日 |
0.1.0 | 2018年6月17日 |
#876 in 解析器实现
27 每月下载次数
22KB
353 行
rust-anitomy
rust-anitomy 是 Anitomy 的Rust绑定,Anitomy是一个用于解析动漫视频文件名的C++库。
安装
将此内容添加到您的 Cargo.toml
[dependencies]
anitomy = "0.2"
要求
由于此crate依赖于 anitomy-sys,因此其要求也适用,有关 anitomy-sys 的信息,请参阅 Xtansia/rust-anitomy-sys。
示例
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);
},
}
}
输出结果
SUCCESS: Parsed the filename successfully!
It is: Toradora! #01 by TaigaSubs
And extracted the following elements: [
Element {
category: FileExtension,
value: "mkv"
},
Element {
category: FileName,
value: "[TaigaSubs]_Toradora!_(2008)_-_01v2_-_Tiger_and_Dragon_[1280x720_H.264_FLAC][1234ABCD]"
},
Element {
category: VideoTerm,
value: "H.264"
},
Element {
category: VideoResolution,
value: "1280x720"
},
Element {
category: AudioTerm,
value: "FLAC"
},
Element {
category: FileChecksum,
value: "1234ABCD"
},
Element {
category: AnimeYear,
value: "2008"
},
Element {
category: EpisodeNumber,
value: "01"
},
Element {
category: ReleaseVersion,
value: "2"
},
Element {
category: AnimeTitle,
value: "Toradora!"
},
Element {
category: ReleaseGroup,
value: "TaigaSubs"
},
Element {
category: EpisodeTitle,
value: "Tiger and Dragon"
}
]
依赖项
~120–300KB