Generate CUE files from audio CDs with MusicBrainz and GNUDB metadata.
Part of the odio project — full documentation.
- Disc ID Calculation: Uses
libdiscidto 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.
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).
-
Clone the repository:
git clone https://github.com/b0bbywan/go-disc-cuer.git cd go-disc-cuer -
Install dependencies (
libdiscid):make deps # or manually: # Debian: sudo apt install libdiscid0 libdiscid-dev # Fedora: sudo dnf install libdiscid libdiscid-devel
-
Build the binary (the version is stamped from
git describe):make build
-
(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.
-
Basic Command Generate a CUE file for the current CD:
disc-cuer
-
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)
- 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
-
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
- 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
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.
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/: SharedDiscInfomodel and MusicBrainz JSON structs.utils/: TOC/disc-id computation and cache-path helpers.
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.