Sha256: a48a12b60b25e3aff961e8de63244b07d2f302f7f52ed4718d2e07d2aee79458

Contents?: true

Size: 611 Bytes

Versions: 1

Compression:

Stored size: 611 Bytes

Contents

module MusicBrainz
  module Bindings
    module ReleaseGroupSearch
      def parse(xml)
        xml.xpath('./release-group-list/release-group').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),
            type: (xml.attribute('type').value rescue nil),
            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/release_group_search.rb