Code Monkey home page Code Monkey logo

libcue.rs's Introduction

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.

libcue.rs's People

Contributors

mistydemeo avatar toru3 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.