Crates.io | cue |
lib.rs | cue |
version | 3.0.0 |
source | src |
created_at | 2016-07-01 20:24:43.271816 |
updated_at | 2024-11-24 10:40:26.32378 |
description | High-level bindings for the libcue library |
homepage | https://github.com/mistydemeo/libcue.rs |
repository | https://github.com/mistydemeo/libcue.rs |
max_upload_size | |
id | 5562 |
size | 37,885 |
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.
Here's a simple example of how to use this crate using a sample CUE sheet:
use cue::cd::{CD, DiscMode};
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().unwrap_or(-1));
println!("Pregap: {}", track.get_zero_pre().unwrap_or(0));
println!("Postgap: {}", track.get_zero_post().unwrap_or(0));
println!("");
}
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!
Both crates are licensed under the GPL 2.0, which is the same license used by libcue.