Sha256: ad89b2e06bab1dbfe56791b37cda9ce6e4520452789727e8e2cf5d2978ba721f

Contents?: true

Size: 629 Bytes

Versions: 4

Compression:

Stored size: 629 Bytes

Contents

# encoding: UTF-8
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

4 entries across 4 versions & 1 rubygems

Version Path
musicbrainz-0.7.7 lib/musicbrainz/bindings/release_group_search.rb
musicbrainz-0.7.6 lib/musicbrainz/bindings/release_group_search.rb
musicbrainz-0.7.5 lib/musicbrainz/bindings/release_group_search.rb
musicbrainz-0.7.4 lib/musicbrainz/bindings/release_group_search.rb