Documentation
¶
Overview ¶
Package lookup finds out what an audio CD is, from MusicBrainz and the Cover Art Archive, using nothing but its table of contents: no names, no audio, and nothing about the person or their files. No key is needed.
It needs no image and no server. A program reading a real drive can fill in a wittycd.TOC from the drive's own table of contents and ask the same way.
matches, err := (&lookup.Client{UserAgent: "MyPlayer/1.0 ( https://example.org )"}).Find(ctx, toc)
The services ask for a client that names itself and for at most one request a second. Every Client in a program shares one gate, so that holds however many there are. Their data is CC0; cover pictures belong to their owners. Show Attribution wherever their data is used.
Index ¶
Constants ¶
const Attribution = "Album data from MusicBrainz (CC0). Covers from the Cover Art Archive."
Attribution is what to show wherever their data is used.
Variables ¶
var ErrBusy = errors.New("MusicBrainz can't be reached just now")
ErrBusy says the service asked to slow down or can't be reached. Try again later.
Functions ¶
Types ¶
type Client ¶
type Client struct {
// HTTP is the client to use; nil means one with no special limits. A server
// should give one that can't be redirected onto its own network.
HTTP *http.Client
// UserAgent names your program, with a way to contact you, as the service asks:
// "MyPlayer/1.0 ( https://example.org )".
UserAgent string
// Base and CoverBase replace the services' addresses in tests.
Base, CoverBase string
}
Client asks the services. The zero value works.
type Match ¶
type Match struct {
ReleaseID string `json:"releaseId"`
Title string `json:"title"`
Artist string `json:"artist"`
Date string `json:"date,omitempty"`
Country string `json:"country,omitempty"`
Barcode string `json:"barcode,omitempty"`
Label string `json:"label,omitempty"`
// Disc is which disc of the release this one is, of Discs.
Disc int `json:"disc"`
Discs int `json:"discs"`
// Exact: the release lists this very disc ID. Otherwise its track lengths are
// only close, so it could be another pressing, or a different album.
Exact bool `json:"exact"`
HasCover bool `json:"hasCover"`
Tracks []TrackName `json:"tracks"`
Group string `json:"group,omitempty"`
URL string `json:"url"`
}
Match is one release a disc could be.