Getting the correct release


#1

I am doing the ISRC lookup for eg.

https://musicbrainz.org/ws/2/isrc/SEUM71401533?inc=releases

In the response I get list of releases. Now how do I filter the one official release. There are many official releases. I just want to get the cover art but many times its difficult to get the correct release id out of the many releases.

So can I figure out which release id to choose programmatically so that I get the correct cover art


#2

What release to choose depends on what you want. First thing I would do is not query the ISRC with releases but instead do another query for each recording you got in your ISRC query (often it is just one recording, but there might be multiple). In the recording query include infos about releases and release groups:

https://musicbrainz.org/ws/2/recording/ba0aff15-7701-4c77-a6cd-6e0b151801c6?inc=releases+release-groups&fmt=xml

Then you can filter by release group primary and secondary type, release status and release date. Likely you want to use only status = Official, and have some order of preference for the release group types.

Update: For fetching the cover art it might be sufficient to decide for a release group. The CAA API provides an endpoint to query the default cover art for a release group, see https://wiki.musicbrainz.org/Cover_Art_Archive/API#.2Frelease-group.2F.7Bmbid.7D.2F


#3

Initially I only have the isrc of the track that is why I am doing the isrc lookup. Even if I do a query for a single recording I will get multiple releases. How do I exactly filter that one release which has the official cover art.

As far as I understand to get a cover art for an album I need to have a release mbid which also I don’t have. That’s why I first do the isrc lookup to get the release id.

Thank you for your response @outsidecontext


#4

Right now I am just choosing the first release in the response. Which is not always the best one to get the cover art.


#5

If I take this request for example :

https://musicbrainz.org/ws/2/recording/ba0aff15-7701-4c77-a6cd-6e0b151801c6?inc=releases&fmt=json&status=official&type=album

In the response the release with the id “1c70f755-8622-41f5-8f69-9c0e8cc082ce” gives the correct album art(which is the third release in the response) from the covert art api doing the following request :

https://coverartarchive.org/release/1c70f755-8622-41f5-8f69-9c0e8cc082ce


#6

The first thing you should do is define what you consder the “correct” album art. So what would you prefer? E.g. I personally would go for the first released album that contained that recording. And if there is no album, I would fall back to a single, and if there is no single I would fall back to a live album etc.

But you could as well say you prefer the single over an album, and only use the album if there is no single (with cover art).

When you now what you want you should also include the release-group info in your recording query:

https://musicbrainz.org/ws/2/recording/ba0aff15-7701-4c77-a6cd-6e0b151801c6?inc=releases+release-groups&fmt=json&status=official

Then you can go through the list of releases and select and sort the ones you care about. E.g. a studio album would be primary type “Album”, secondary type is empty. A live album is primary type “Album”, secondary type “Live”. There are also primary types “Single” and “EP”.


#7

So if I get the first release across all the recordings and then get the id of that release, it gives me the correct album cover most of the time.