Expand description
The Cover Art Archive: the front image of a record, when it has one.
Deliberately no network, like crate::musicbrainz: this module turns
an index somebody else fetched into an address to download, and decides
which image is the front one. Reaching the address is the client’s job.
§The index says what exists, so nothing here guesses
Asking coverartarchive.org about a release answers with a small JSON
document — not the image — listing every image it holds:
{ "images": [ { "front": true, "types": ["Front"], "approved": true,
"image": "…/12345.jpg",
"thumbnails": { "250": "…", "500": "…", "1200": "…" } } ],
"release": "https://musicbrainz.org/release/…" }The sizes are named in the answer, so a caller asking for 1200 px is
told whether one exists rather than being sent to an address that might
404. That is why the index is fetched first: one small request decides
everything, including whether there is anything to download at all.
Structs§
- Front
- The front image of a record, at the size asked for.
- Rendered
Image - A validated original or a derived PNG thumbnail kept only in memory.
Enums§
- Kind
- What a picture is of, for the few kinds worth telling apart.
- Size
- Which image to take, of the ones the archive offers.
- Written
- What became of one image.
Constants§
- EXTRAS
- The subfolder everything that is not the cover is written into.
- SOURCE
- The name records from this service carry in
sources.json. - WEB_
SERVICE - Base address of the service.
Functions§
- artist_
destination - Existing artist artwork location; watched roots are never artist folders. An unavailable or path-shaped fallback identifier has no cache destination.
- asset_
destination - Confined cache directory for an artist or label’s opaque identifier.
- exists_
beside - Whether an image of this kind is already sitting beside the music, under
either extension
write_imagecan produce. - exists_
image - Whether this image already exists at the name
write_imagewould use. - extras_
in - Where the images that are not the cover belong, for one album folder.
- file_
name - What to call the file written beside the music.
- front
- Picks the front image out of an index, at the size asked for.
- image_
kind - Which supported format signature these bytes carry.
- image_
name - What to call one image of a given kind, when several may share it.
- images
- Every image an index holds, with what each one is of.
- index_
url - Where to ask what images a record has.
- positions
- Where each image sits among the others of its own kind.
- release_
index_ url - Where to ask about one precise edition, when the tags name one.
- render_
image - Validate an image and optionally produce a thumbnail for a client response.
- shared_
artist_ folder - Parent shared by every local edition, absent when editions span folders.
- validate_
index - Refuses a malformed index before a caller records it as having no artwork.
- write_
beside - Writes an image beside music, or says why it did not.
- write_
image - Writes one image of a known kind, under the name that says what it is.