Merge
This commit is contained in:
@@ -16,13 +16,15 @@ module MusicBrainz
|
||||
end
|
||||
|
||||
def self.find mbid
|
||||
@artist = self.parse_xml(Nokogiri::XML(MusicBrainz.load('http://musicbrainz.org/ws/2/artist/' + mbid)))
|
||||
res = MusicBrainz.load('http://musicbrainz.org/ws/2/artist/' + mbid)
|
||||
return nil if res.nil?
|
||||
@artist = self.parse_xml(Nokogiri::XML(res))
|
||||
end
|
||||
|
||||
def self.parse_xml xml
|
||||
@artist = MusicBrainz::Artist.new
|
||||
@artist.id = xml.css('artist').attr('id').value
|
||||
@artist.type = xml.css('artist').attr('type').value
|
||||
@artist.type = xml.css('artist').attr('type').value unless xml.css('artist').nil? or xml.css('artist').attr('type').nil?
|
||||
@artist.name = xml.css('artist > name').text
|
||||
@artist.country = xml.css('artist > country').text unless xml.css('artist > country').empty?
|
||||
@artist.date_begin = xml.css('artist > life-span > begin').text unless xml.css('artist > life-span > begin').empty?
|
||||
|
||||
Reference in New Issue
Block a user