2 releases (1 stable)

1.0.0 May 21, 2018
0.1.0 Jul 1, 2016

#50 in Parser implementations

Download history 2/week @ 2018-08-20 4/week @ 2018-08-27 6/week @ 2018-09-03 2/week @ 2018-09-10 3/week @ 2018-09-17 5/week @ 2018-09-24 12/week @ 2018-10-01 1/week @ 2018-10-08 10/week @ 2018-10-15 26/week @ 2018-10-22 4/week @ 2018-10-29 21/week @ 2018-11-05 11/week @ 2018-11-12

93 downloads per month

GPL-2.0 license

23KB
333 lines

cue

This crate provides Rust bindings for the libcue library, which supports parsing and interpreting CUE sheets. The CUE sheet format is commonly used for authoring CDs and to store copies of ripped CDs.

This repository contains two crates: cue-sys, which contains raw bindings for the original C API, and cue, which provides a higher-level, more Rustic interface.

Example

Here's a simple example of how to use this crate using a sample CUE sheet:

use cue::cd::{CD, DiscMode};
use cue::track::{TrackMode, TrackSubMode};

let cue_sheet = "FILE \"example.img\" BINARY
  TRACK 01 MODE1/2352
    INDEX 01 00:00:00
  TRACK 02 AUDIO
    PREGAP 00:02:00
    INDEX 01 58:41:36
  TRACK 03 AUDIO
    INDEX 00 61:06:08
    INDEX 01 61:08:08
";

let cd = CD::parse(cue_sheet.to_string()).unwrap();

println!("Number of tracks: {}", cd.get_track_count());
let mode = match cd.get_mode() {
    DiscMode::CD_DA => "CD-DA",
    DiscMode::CD_ROM => "CD-ROM",
    DiscMode::CD_ROM_XA => "CD-ROM XA",
};
println!("Mode: {}", mode);
println!("");

for (index, track) in cd.tracks().iter().enumerate() {
    println!("Track {}", index + 1);
    println!("Filename: {}", track.get_filename());
    println!("Start: {}", track.get_start());
    println!("Length: {}", track.get_length());
    println!("Pregap: {}", track.get_zero_pre());
    println!("Postgap: {}", track.get_zero_post());
    println!("");
}

Contributing

If you have trouble using this crate, feel free to file an issue asking for help. I'll do my best to help you out!

Pull requests are very welcome. If you're new to open source, or to Rust, just let me know and I'll be glad to help you through the process of contributing!

License

Both crates are licensed under the GPL 2.0, which is the same license used by libcue.

Dependencies

~165KB