28 releases (7 breaking)

0.8.0 Feb 26, 2025
0.6.1 Jan 9, 2025
0.6.0 Dec 13, 2024
0.5.3 Nov 28, 2024
0.1.0 Dec 26, 2022

#217 in Database interfaces

Download history 7/week @ 2024-11-13 6/week @ 2024-11-20 150/week @ 2024-11-27 6/week @ 2024-12-04 120/week @ 2024-12-11 7/week @ 2024-12-18 143/week @ 2025-01-08 2/week @ 2025-01-15 7/week @ 2025-02-05 132/week @ 2025-02-19 205/week @ 2025-02-26

344 downloads per month

WTFPL license

125KB
2K SLoC

CDTOC

docs.rs changelog
crates.io ci deps.rs
license contributions welcome

CDTOC is a simple Rust library for parsing and working with audio CD tables of contents, namely in the form of CDTOC-style metadata values.

By default it can also generate disc IDs for services like AccurateRip, CDDB, CUETools Database, and MusicBrainz, but you can disable the corresponding crate feature(s) — accuraterip, cddb, ctdb, and musicbrainz respectively — to shrink the dependency tree if you don't need that functionality.

Examples

use cdtoc::Toc;

// From a CDTOC string.
let toc1 = Toc::from_cdtoc("4+96+2D2B+6256+B327+D84A").unwrap();

// From the raw parts.
let toc2 = Toc::from_parts(
    vec![150, 11563, 25174, 45863],
    None,
    55370,
).unwrap();

// Either way gets you to the same place.
assert_eq!(toc1, toc2);

// You can also get a CDTOC-style string back at any time:
assert_eq!(toc1.to_string(), "4+96+2D2B+6256+B327+D84A");

De/Serialization

The optional serde crate feature can be enabled to expose de/serialization implementations for this library's types:

Type Format Notes
AccurateRip String
Cddb String
Duration u64
ShaB64 String MusicBrainz and CTDB IDs.
Toc String
Track Map
TrackPosition String

Installation

Add cdtoc to your dependencies in Cargo.toml, like:

[dependencies]
cdtoc = "0.8.*"

The disc ID helpers require additional dependencies, so if you aren't using them, be sure to disable the default features (adding back any you do want) to skip the overhead.

[dependencies.cdtoc]
version = "0.8.*"
default-features = false

Dependencies

~0.4–0.9MB
~18K SLoC