1 /* vi: set et sw=4 ts=4 si: */
3 var musicbrainz = function() {
4 this.baseUrl = 'http://musicbrainz.org/ws/2/';
5 this.fmtArg = 'fmt=json';
7 this.getArtist = function(q) {
9 lookup_url = self.baseUrl + 'artist/?query="' + q +
11 deferred = new $.Deferred();
13 if (q !== undefined) {
14 $.getJSON(lookup_url).done(function(data) {
16 artist_url = self.baseUrl + 'artist/' +
17 data.artist[0].id + '?' + self.fmtArg;
18 $.getJSON(artist_url).done(function(data) {
19 deferred.resolve(data);
29 return deferred.promise();
33 window.MusicBrainz = new musicbrainz();