Getting Started with MusicBrainz Database/API

Hi,

I’m writing a tool in Python to help organise my music. All I have is the textual artist name, album name and track names(). In the API documentation I found this:

On each entity resource, you can perform three different GET requests:

lookup: /<ENTITY_TYPE>/?inc= *
browse: /<RESULT_ENTITY_TYPE>?<BROWSING_ENTITY_TYPE>=&limit=&offset=&inc=
search: /<ENTITY_TYPE>?query=&limit=&offset=

… except that browse and search are not implemented for genre entities at this time.

*Note: Keep in mind only the search request is available without an [MBID] (or, in specific cases, a disc ID, ISRC or ISWC). If all you have is the name of an artist or album, for example, you’ll need to make a search and pick the right result to get its MBID; only then will you able to use it in a lookup or browse request.

So, I do I form the request for Artist:David Bowie in order to get an MBID? An example would be great!

All the Best
Dave

What do you like to get as response?
You already have the artist name, release and track name.
What exactly do you need from the API as additional data?

A simple starting query would look like this:
https://musicbrainz.org/ws/2/release/?query=artist:david%20bowie%20AND%20release=Ziggy%20Stardust%20

This would return approximately the same data as the “nice” view from this GUI search
https://musicbrainz.org/taglookup/index?tag-lookup.artist=david+bowie&tag-lookup.release=ziggy+stardust

BTW: There are many more examples in the Wiki:
https://wiki.musicbrainz.org/MusicBrainz_API
including some links to already existing libraries.

2 Likes

Hi,

Thank you so much for this, I was pulling my hair out trying to get the syntax right!

I have a folder structure like this:

MusicLib/Imported/ArtistName/AlbumName/TrackName

MusicLib //Folder
Imported //Folder
ArtistName //Folder (Artist Name)
AlbumName //Folder (Album Name)
TrackName //File (Audio)

I want to look up the Artist and:

  1. Check if the Album name is correct and that the Artist actually relased the album.

  2. Check that the Tracks are named correctly and that there are none missing or added.

I want to do other things too, but this is these are first main functions I want to perform.

All the Best
Dave

First: I don’t want to to slow down your enthusiasm, really.
But comparing an album name with your existing album name is much more complicated as you may think at first sight.
If you are looking for “Ziggy Stardust” from David Bowie in my example, you will see that MB will give you back currently several pages of possible matching album names.
It will be become really tricky to decide if one of this many returned album names exactly match your local album name. It could be the name from a LP and you have the CD. It could be the name of a release from the USA and you have a German release. It could be the name from the 3 track release or from a double CD with 35 tracks and so on…

The same is true if you want to compare track names. “Tracks” - or reccording or work how it is named here in MB - can appear on many different releases in many countries and variations. To decide if your current track is exactly the one with same length, at the same position from the same CD from the same release country at the same release year will become really tricky.

I don’t say it is impossible, but you have to find a way to pindown your search as much as possible.

And even then remains the question:
Is your local
“Ziggy StarDust”
the same as the
“Ziggy Stardust”
from MusicBrainz?

Or could it be that you have a release/album which is not yet available in the MB database?

1 Like

Ok, all the Tracks are from CDs, but have been imported using many different apps, which all have/had different naming conventions. One of the problems I have is that I will often get as a track name - “‘V’ Ziggy Stardust”, e.g. ‘V’ prepends the track name, in this case I want to correct it to “Ziggy Stardust” (With maybe the track number prepended). I am also looking at getting the metadata from the audio file directly (rather relying of the folder/file names) which should make it more reliable.

I have a collection of around 20,000 tracks, 95% are ok, I just want a tool to wheedle out the 5% that are bad.

Cheers
Dave

Maybe you could have a look at Picard

the official free tagging software from Musicbrainz?

It can help you organize your albums, detect the matching one, help you rename tracks and many many more.

Don’t forget to check the Quick Start - MusicBrainz Picard and the very useful and searchable Online-Documentation.

2 Likes

Hi, yes, I’ve seen Picard and intend to use it once I’ve identified the 5% with problems.