Skip to content

Latest commit

 

History

62 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

odio

go-disc-cuer

Generate CUE files from audio CDs with MusicBrainz and GNUDB metadata.

Release License Go Report Card Go Reference GitHub Sponsors

Audio CD CUE generation MusicBrainz GNUDB

Part of the odio project — full documentation.

Go libdiscid

Features

  • Disc ID Calculation: Uses libdiscid to compute MusicBrainz and GNUDB compatible disc IDs.
  • Metadata Integration: Fetch track and album metadata from GNUDB or MusicBrainz.
  • Fix Incorrect CUE Files: Force the use of a specific MusicBrainz release to correct or regenerate CUE files.
  • Configurable: Allows configuration through files, environment variables, and command-line flags.

Installation

From Releases

Download the prebuilt linux/amd64 binary attached to the latest release:

curl -L -o disc-cuer \
  https://github.com/b0bbywan/go-disc-cuer/releases/latest/download/disc-cuer-linux-amd64
chmod +x disc-cuer
sudo mv disc-cuer /usr/local/bin/

You still need libdiscid installed at runtime (see the dependency step below).

From Source

  1. Clone the repository:

    git clone https://github.com/b0bbywan/go-disc-cuer.git
    cd go-disc-cuer
  2. Install dependencies (libdiscid):

    make deps
    # or manually:
    #   Debian:  sudo apt install libdiscid0 libdiscid-dev
    #   Fedora:  sudo dnf install libdiscid libdiscid-devel
  3. Build the binary (the version is stamped from git describe):

    make build
  4. (Optional) Install globally:

    sudo mv disc-cuer /usr/local/bin/

Other Makefile targets: make test (race + coverage), make lint, make dist (linux/amd64 release binary into dist/), make clean.

Usage

  1. Basic Command Generate a CUE file for the current CD:

    disc-cuer
  2. Options

  • --overwrite: Regenerate the CUE file even if it exists.
  • --musicbrainz <release_id>: Specify a MusicBrainz release ID to fetch album metadata.
  • --disc-id <disc_id>: Provide a custom disc ID. This requires --musicbrainz to associate metadata with the ID.
  • --device <device>: Specify the disc drive device to read from (overrides config or default)
  1. Configuration The tool loads configurations in the following order of priority:
  • Command-line flags.
  • Environment variables prefixed with DISC_CUER_.
  • Configuration files located at:
    • /etc/disc-cuer/config.yml
    • ~/.config/disc-cuer/config.yaml
  1. Example Configuration

    Please note that gnuHelloEmail is mandatory to use gnudb source

    gnuHelloEmail: "your-email@example.com"  # (no default)
    gnuDbUrl: "https://gnudb.gnudb.org"      # (default)
    cacheLocation: "/var/cache/disc-cuer"    # (root default, else ~/.cache/disc-cuer)
    device: "/dev/sr0"                       # (default)
    DISC_CUER_GNUHELLOEMAIL="your-email@example.com" DISC_CUER_GNUDBURL="https://gnudb.gnudb.org" DISC_CUER_CACHELOCATION="/var/cache/disc-cuer" DISC_CUER_DEVICE="/dev/sr0" disc-cuer --disc-id <id> --musicbrainz <release_id> --overwrite

Examples

  • Fetch Metadata from music brainz and force Generate CUE for current disc
    disc-cuer --musicbrainz <release_id> --overwrite
  • Force Custom Disc ID
    disc-cuer --disc-id <disc_id> --musicbrainz <release_id> --overwrite

Use as a library

go-disc-cuer can be embedded in another program (for example go-mpd-discplayer). Build a *config.Config with your own app name and version, then drive the flow through cue.New(cfg).Generate(...):

import (
    "github.com/b0bbywan/go-disc-cuer/config"
    "github.com/b0bbywan/go-disc-cuer/cue"
)

// Your app's identity is what the GNUDB hello reports; pass "" to fall back to
// disc-cuer's own defaults. The third argument overrides the cache base folder.
cfg, err := config.NewConfig("my-app", "1.2.3", "")
if err != nil {
    return err
}

path, err := cue.New(cfg).Generate(cue.Options{
    Device:    "/dev/sr0", // read this drive (omit DiscID to read the disc)
    Overwrite: true,
})

Options also accepts DiscID + MusicBrainzID to bypass the drive/TOC lookup and target a specific release.

Project Structure

  • main.go: Entry point and CLI flag parsing.
  • cue/: Flow orchestration (Generate), CUE rendering, and cover-art fetching.
  • gnudb/: GNUDB (CDDB protocol) integration.
  • musicbrainz/: MusicBrainz web-service integration.
  • config/: Configuration package built on github.com/spf13/viper.
  • types/: Shared DiscInfo model and MusicBrainz JSON structs.
  • utils/: TOC/disc-id computation and cache-path helpers.

Contributing

Contributions are welcome! Feel free to submit issues, feature requests, or pull requests.

  • Fork the repository.
  • Create a feature branch.
  • Commit your changes and open a pull request.

About

tool to create cue file from current disc

Topics

Resources

Stars

2 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages