2013-11-06 02:15:09 +00:00
|
|
|
|
# -*- encoding : utf-8 -*-
|
2012-10-12 12:45:51 +00:00
|
|
|
|
module MusicBrainz
|
|
|
|
|
module Bindings
|
|
|
|
|
module Artist
|
|
|
|
|
def parse(xml)
|
2013-06-14 10:33:35 +00:00
|
|
|
|
xml = xml.xpath('./artist')
|
|
|
|
|
|
|
|
|
|
return {} if xml.empty?
|
|
|
|
|
|
2012-10-12 12:45:51 +00:00
|
|
|
|
{
|
|
|
|
|
id: (xml.attribute('id').value rescue nil),
|
|
|
|
|
type: (xml.attribute('type').value rescue nil),
|
|
|
|
|
name: (xml.xpath('./name').text.gsub(/[`’]/, "'") rescue nil),
|
|
|
|
|
country: (xml.xpath('./country').text rescue nil),
|
|
|
|
|
date_begin: (xml.xpath('./life-span/begin').text rescue nil),
|
2013-06-14 10:33:35 +00:00
|
|
|
|
date_end: (xml.xpath('./life-span/end').text rescue nil)
|
|
|
|
|
}.merge(Relations.parse(xml))
|
2012-10-12 12:45:51 +00:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
extend self
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|