Searching help on using the XML Web Service

Hello,
As I explained in my presentation, I am working on an application written in Javascript for smartphones to fill an offline database.
I was wondering if anyone could share some code to get me started, I need to call the service with a BarCode, get the most informations and also the image, I understood there was another service for that but I am not sure how to go from one service to the other.
Also, I would like to create objects that would contains all the information on one CD, I have found an MMD schema but I don’t know how to use this.
If I could have a bit a of code in JavaScript, that calls the service with a barcode, initialize a class with the result and fetch the CD image, it would just be perfect, but it is probably a dream.

Thanks for any help,
Claude

There is a musicbrainz app that searches and does barcode lookups maybe you could start there and look at the code.
https://musicbrainz.org/doc/MusicBrainz_for_Android

There is also a Picard barcode scanner app.
You need Picard running on a PC and the app scans the barcode and sends it to Picard where that does the database lookup in musicbrainz.

This should get you started (using jQuery for simplicity):

var queryUrl = 'http://musicbrainz.org/ws/2/release/?query=barcode:5016583115227&fmt=json';
$.get(queryUrl, function(result) {
  console.log('Found releases: ', result.count);
  if (result.count > 0) {
    var mbid = result.releases[0].id;
    console.log('First release MBID:', mbid);
    console.log('Cover art URL:', 'http://coverartarchive.org/release/' + mbid + '/front');
  }
});

See the documentations for the MusicBrainz API and the Cover Art Archive.

1 Like