Crates.io | mpls |
lib.rs | mpls |
version | 0.2.0 |
source | src |
created_at | 2020-05-21 17:57:55.267659 |
updated_at | 2020-05-28 09:50:07.812802 |
description | A movie playlist file (MPLS) parser. |
homepage | |
repository | https://github.com/domyd/mpls |
max_upload_size | |
id | 244230 |
size | 105,787 |
A movie playlist file (MPLS) parser. Written in Rust using the nom parser combinator library.
Dual-licensed under MIT and Apache 2.0.
use std::fs::File;
use std::io::Read;
use mpls::Mpls;
fn main() -> std::io::Result<()> {
// open the playlist file
let mut file = File::open("00800.mpls")?;
// parse the play list
let mpls = Mpls::from(&file).expect("failed to parse MPLS file.");
// extract the play list's angles
let angles = mpls.angles();
// extract the segments
for angle in angles {
let segment_numbers: Vec<i32> = angle
.segments()
.iter()
.map(|s| s.file_name.parse::<i32>().unwrap())
.collect();
println!("angle {}: {:?}", angle, segment_numbers);
}
Ok(())
}
Add this to your Cargo.toml
:
[dependencies]
mpls = "0.2.0"
See the reference docs on crates.io.