TL;DR Is there a way to check for release-group cover art without triggering a 404?
For a release you check if it has cover art with the MusicBrainz API:
https://musicbrainz.org/ws/2/release/70b969e8-2d56-4b27-937a-0f20b3bfe987?fmt=json
This will give you a JSON object which includes a "cover-art-archive" property:
"cover-art-archive": {
"darkened": false,
"back": false,
"front": true,
"count": 1,
"artwork": true
},
That makes it trivially easy to check if a certain release has cover art. In my application I check it like so:
testReleaseArtwork(mbid) {
return fetch(`${this.#APIs.MusicBrainz}release/${mbid}?fmt=json`)
.then((response) => response.json())
.then((data) => {
return data["cover-art-archive"].front
})
}
This function is called from another function. That function loops through the first ten search results until it finds a release with a cover. This works but the results are a bit wonky at times as not all scans of artwork are of the same quality. I thought therefore that it would be better to first check for release-group art work.
When you try the query mentioned above for a release-group the result is a bit different.
https://musicbrainz.org/ws/2/release-group/b290e941-2908-4ef2-9815-63f084f041a6?fmt=json
The result for that query doesn’t include a "cover-art-archive" property. At which point I think you have to default back to querying the CoverArtArchive API:
https://coverartarchive.org/release/026c90a2-b9ef-498b-b0a6-cb790eb556d8/
Which is fine when there’s art work to be found. But if there’s no art work it will throw a 404. Which is what I’d like to avoid. The reason being it looks amaturistic in the DevTools but maybe that’s not a good reason. Another reason is that to me it’s not an actual error, it’s an indication of a lack of information. It tells me I should go and loop through the releases.
Here’s a release group without cover art as an example.
Is there any way to check for release-group cover art without triggering a 404?
Related to: