Sha256: 6df5dfcaeeee5efa259942ec9edc16b7d50f8d474b5cf017af60b826b296f173
Contents?: true
Size: 827 Bytes
Versions: 1
Compression:
Stored size: 827 Bytes
Contents
module MusicBrainz module Bindings module ArtistSearch def parse(xml) xml.xpath('./artist-list/artist').map do |xml| { id: (xml.attribute('id').value rescue nil), mbid: (xml.attribute('id').value rescue nil), # Old shit name: (xml.xpath('./name').text.gsub(/[`’]/, "'") rescue nil), sort_name: (xml.xpath('./sort-name').gsub(/[`’]/, "'") rescue nil), type: (xml.attribute('type').value rescue nil), score: (xml.attribute('score').value.to_i rescue nil), desc: (xml.xpath('./disambiguation').value rescue nil), aliases: (xml.xpath('./alias-list/alias').map{ |xml| xml.text } rescue []) } rescue nil end.delete_if{ |item| item.nil? } end extend self end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
musicbrainz-0.8.0 | lib/musicbrainz/bindings/artist_search.rb |