leoschwarz / cue_sheet Goto Github PK
View Code? Open in Web Editor NEWCue Sheet parsing for Rust
Home Page: https://crates.io/crates/cue_sheet
License: GNU General Public License v3.0
Cue Sheet parsing for Rust
Home Page: https://crates.io/crates/cue_sheet
License: GNU General Public License v3.0
What should happen if the file is not found:
Return an error or just a None variant? Maybe this would collide with implementing better Error handling with a custom Enum of all possible error variants.
Quoting from the hydrogen audio wiki linked in the docs:
Line breaks must be used between commands
Unfortunately, it appears that this library currently doesn't consider newlines when parsing, resulting in it failing to parse cue sheets that (for example) include commands like REM DATE 2011-12-22
.
I added this under [dependencies]
in Cargo.toml
: cue_sheet = "0.2.0"
$ wget https://raw.githubusercontent.com/leoschwarz/cue_sheet/master/examples/to_mb.rs
$ cargo build
...
either src/lib.rs, src/main.rs, a [lib] section, or [[bin]] section must be present
$ mv to_mb.rs main.rs
$ cargo build ✭master
Compiling music v0.1.0 (/home/michael/rust/music)
error[E0599]: no method named `unwrap` found for type `std::string::String` in the current scope
--> src/main.rs:48:29
|
48 | t.clone().title.unwrap(),
| ^^^^^^
error: aborting due to previous error
For more information about this error, try `rustc --explain E0599`.
error: Could not compile `music`.
To learn more, run the command again with --verbose.
I have a CD-ROM disc whose second track has a pregap (sample CUE sheet at the end of the end of this post). It looks like parsing stops as soon as that's encountered; the resulting parsed Tracklist
has only two tracks, and the second track has no indices. I assume that's because of the explicit break
here: https://github.com/leoschwarz/cue_sheet/blob/master/src/tracklist.rs#L191
FILE "disc.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
Especially the duration parsing should be orthogonal to keeping the Index values for each track. Just store both and let the API user decide what to do.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.