Musicbrainz Docker cover_art_archive doesn't have artwork?

In the musicbrianz psql DB, how would one connect a release group to covert art? Meaning, an actual URL to display art work. I see filesize etc. But not anything actually linking to an image?

Or would I need to use the cover_art c lib to get those urls?

Thanks!

Hi Rob,

The SQL tables linking a release group and cover art data are explained in MusicBrainz Database / Schema - MusicBrainz

All the data needed to build such URL is in those tables.

If a release has been manually selected by editors for this release group, then you can find it with:

   SELECT 'https://coverartarchive.org/release/' || r.gid || '/' || ca.id || '-250.jpg'
     FROM musicbrainz.release_group AS rg
     JOIN cover_art_archive.release_group_cover_art AS rgca
       ON rg.id = rgca.release_group
     JOIN musicbrainz.release AS r
       ON rgca.release = r.id
     JOIN cover_art_archive.cover_art AS ca
       ON r.id = ca.release
     JOIN cover_art_archive.cover_art_type AS cat
       ON ca.id = cat.id
    WHERE rg.id = ? -- Input release group id
      AND cat.type_id = 1 -- Front cover only
 ORDER BY ca.ordering ASC LIMIT 1 -- Main only

Otherwise you have to make your own selection (based on release event, packaging, status) from:

   SELECT 'https://coverartarchive.org/release/' || r.gid || '/' || ca.id || '-250.jpg'
     FROM musicbrainz.release_group AS rg
     JOIN musicbrainz.release AS r
       ON rg.id = r.release_group
     JOIN cover_art_archive.cover_art AS ca
       ON r.id = ca.release
     JOIN cover_art_archive.cover_art_type AS cat
       ON ca.id = cat.id
    WHERE rg.id = ? -- Input release group id
      AND cat.type_id = 1 -- Front cover only

Note: I just roughly tested these queries but more refinements and optimizations are possible.

You can but using libcoverart send queries to the Cover Art Archive API which has rate limit. It is mostly useful when you don‘t have a replicated database at hand.

4 Likes