extern crate flac; extern crate nom; use flac::{Stream, ReadStream, metadata}; use std::fs::File; fn main() { //let stream_info = metadata::get_stream_info( //let vorbis_comments = metadata::get_vorbis_comment( //"/Users/Jeremy/Downloads/Music/GATE ~Sore wa Akatsuki no you ni~/01 GATE ~Sore wa Akatsuki no you ni~.flac" //"/Users/Jeremy/Downloads/Music/GATE ~Sore wa Akatsuki no you ni~/02 GATE ~Sore wa Akatsuki no you ni~ (TV size).flac" //"/Users/Jeremy/Downloads/Music/GATE ~Sore wa Akatsuki no you ni~/03 GATE ~Sore wa Akatsuki no you ni~ (instrumental).flac" //"/Users/Jeremy/Downloads/Music/Saenai Heroine no Sodatekata ED/01 Colorful..flac" //"/Users/Jeremy/Downloads/Music/Saenai Heroine no Sodatekata ED/02 dim.flac" //"/Users/Jeremy/Downloads/Music/Zomboy - The Dead Symphonic EP/01 - Nuclear (Hands Up).flac" //"/Users/Jeremy/Downloads/Music/Zomboy - The Dead Symphonic EP/02 - Hoedown.flac" //"/Users/Jeremy/Downloads/Music/Zomboy - The Dead Symphonic EP/03 - Vancouver Beatdown.flac" //"/Users/Jeremy/Downloads/Music/Zomboy - The Dead Symphonic EP/04 - City 2 City ft Belle Humble.flac" //"/Users/Jeremy/Downloads/Music/Zomboy - The Dead Symphonic EP/05 - Deadweight.flac" //"/Users/Jeremy/Downloads/Music/Zomboy - The Dead Symphonic EP/06 - Gorilla March.flac" //); //if let Ok(info) = stream_info { // println!("stream info"); // println!(" Minimum block size: {}", info.min_block_size); // println!(" Maximum block size: {}", info.max_block_size); // println!(" Minimum frame size: {}", info.min_frame_size); // println!(" Maximum frame size: {}", info.max_frame_size); // println!(" Sample rate: {}", info.sample_rate); // println!(" Number of channels: {}", info.channels); // println!(" Bits per sample: {}", info.bits_per_sample); // println!(" Total samples: {}", info.total_samples); // println!(" MD5 sum: {:?}", info.md5_sum); //}; //if let Ok(vorbis) = vorbis_comments { // println!("vorbis comment"); // println!(" {}", vorbis.vendor_string); // for comment in vorbis.comments { // println!(" {}: {}", comment.0, comment.1); // } //} let filename = "/Users/Jeremy/Downloads/Music/GATE ~Sore wa Akatsuki no you ni~/01 GATE ~Sore wa Akatsuki no you ni~.flac"; //"/Users/Jeremy/Downloads/Music/GATE ~Sore wa Akatsuki no you ni~/02 GATE ~Sore wa Akatsuki no you ni~ (TV size).flac"; //"/Users/Jeremy/Downloads/Music/GATE ~Sore wa Akatsuki no you ni~/03 GATE ~Sore wa Akatsuki no you ni~ (instrumental).flac"; //"/Users/Jeremy/Downloads/Music/Saenai Heroine no Sodatekata ED/01 Colorful..flac"; //"/Users/Jeremy/Downloads/t.flac"; //"/Users/Jeremy/Downloads/Music/Saenai Heroine no Sodatekata ED/02 dim.flac"; //"/Users/Jeremy/Downloads/Music/Zomboy - The Dead Symphonic EP/01 - Nuclear (Hands Up).flac"; //"/Users/Jeremy/Downloads/Music/Zomboy - The Dead Symphonic EP/02 - Hoedown.flac"; //"/Users/Jeremy/Downloads/Music/Zomboy - The Dead Symphonic EP/03 - Vancouver Beatdown.flac"; //"/Users/Jeremy/Downloads/Music/Zomboy - The Dead Symphonic EP/04 - City 2 City ft Belle Humble.flac"; //"/Users/Jeremy/Downloads/Music/Zomboy - The Dead Symphonic EP/05 - Deadweight.flac"; //"/Users/Jeremy/Downloads/Music/Zomboy - The Dead Symphonic EP/06 - Gorilla March.flac"; //"/Users/Jeremy/Downloads/Music/WEAVER - Yamada-kun/01 Kuchizuke Diamond.flac"; if let Ok(stream) = Stream::>::from_file(filename) { let info = stream.info(); println!("stream info"); println!(" Minimum block size: {}", info.min_block_size); println!(" Maximum block size: {}", info.max_block_size); println!(" Minimum frame size: {}", info.min_frame_size); println!(" Maximum frame size: {}", info.max_frame_size); println!(" Sample rate: {}", info.sample_rate); println!(" Number of channels: {}", info.channels); println!(" Bits per sample: {}", info.bits_per_sample); println!(" Total samples: {}", info.total_samples); println!(" MD5 sum: {:?}", info.md5_sum); for block in stream.metadata() { match block.data { metadata::Data::StreamInfo(_) => continue, metadata::Data::Padding(_) => println!("padding"), metadata::Data::Application(ref a) => { println!("application"); println!(" ID: {}", a.id); println!(" Data: {:?}", a.data); } metadata::Data::SeekTable(ref s) => { let mut count = 0; println!("seek table"); for seek_point in s { println!(" Seek Point #{}", count); println!(" Sample number: {}", seek_point.sample_number); println!(" Stream offset: {}", seek_point.stream_offset); println!(" Frame samples: {}", seek_point.frame_samples); count += 1; } } metadata::Data::VorbisComment(ref v) => { println!("vorbis comment"); println!(" {}", v.vendor_string); for comment in &v.comments { println!(" {:?}", comment); } } metadata::Data::CueSheet(ref c) => { println!("cue sheet"); println!(" Media catalog number: {}", c.media_catalog_number); println!(" Lead in: {}", c.lead_in); println!(" Is CD: {}", c.is_cd); for track in &c.tracks { println!(" Track #{}", track.number); println!(" Offset: {}", track.offset); println!(" ISRC: {}", track.isrc); println!(" Is Audio: {}", track.is_audio); println!(" Is Pre-emphasis: {}", track.is_pre_emphasis); for index in &track.indices { println!(" Index #{}", index.number); println!(" Offset: {}", index.offset); } } } metadata::Data::Picture(ref p) => { println!("picture"); println!(" Picture Type: {:?}", p.picture_type); println!(" Mime Type: {}", p.mime_type); println!(" Description: {}", p.description); println!(" Width: {}", p.width); println!(" Height: {}", p.height); println!(" Depth: {}", p.depth); println!(" Colors: {}", p.colors); } metadata::Data::Unknown(_) => println!("unknown"), } } } }