Hare bindings for MusicBrainz libdiscid
ef86556b — Philipp Wolfer a month ago
Updated link to issue tracker
f186235d — Philipp Wolfer a month ago
Add usage example to docs
9cec015b — Philipp Wolfer a month ago
gitignore .vscode



You can also use your local clone with git send-email.

#Hare bindings for MusicBrainz libdiscid

builds.sr.ht status

The discid module provides Hare bindings for the MusicBrainz DiscID library libdiscid. It allows calculating DiscIDs (MusicBrainz and freedb) for Audio CDs. Additionally the library can extract the MCN/UPC/EAN and the ISRCs from disc.


  • libdiscid >= 0.6.0


use fmt;
use discid;

export fn main() void = {
    const disc = discid::new();
    defer discid::close(disc);
    // Specifying the device is optional. If set to void
    // a platform specific default will be used.
    const device = "/dev/cdrom";
    const features = discid::features::READ | discid::features::MCN;
    match (discid::read_features(disc, device, features)) {
    case let err: discid::error => fmt::fatal(err);
    case =>
        fmt::printfln("DiscID: {}", discid::get_id(disc))!;
        fmt::printfln("MCN   : {}", discid::get_mcn(disc))!;

Remember to link your program against libdiscid by using the -ldiscid parameter in the hare build command.

The API documentation can be viewed online at https://phw.srht.site/docs/hare-discid

#Run the example

hare run -ldiscid example/discid/main.ha


The source code for hare-discid is available on SourceHut.

To report issues or feature requests please create a ticket.

Patches can be submitted to the mailing list. You can clone the repository directly on SourceHut and submit your changes with the "Prepare patchset" button. Please see SourceHut's documentation for sending patches upstream for details.


hare-discid Copyright (c) 2023 by Philipp Wolfer ph.wolfer@gmail.com

hare-discid is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

See LICENSE for details.