Sha256: 3efe36b24f3d0e7db038f3ce7fdc9eb8dd04f2fc7b0d008d842b0e87e63a1e72

Contents?: true

Size: 720 Bytes

Versions: 1

Compression:

Stored size: 720 Bytes

Contents

module MusicBrainz
  module Bindings
    module RecordingSearch 
      def parse(xml)
        xml.xpath('./recording-list/recording').map do |xml|
          {
            id: (xml.attribute('id').value rescue nil),
            mbid: (xml.attribute('id').value rescue nil), # Old shit
            title: (xml.xpath('./title').text.gsub(/[`’]/, "'") rescue nil),
            artist: (xml.xpath('./artist-credit/name-credit/artist/name').text rescue nil),
						releases: (xml.xpath('./release-list/release/title').map{ |xml| xml.text } rescue []),
						score: (xml.attribute('score').value.to_i rescue nil)
          } 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/recording_search.rb