1
0
Fork 0

Merge pull request #13 from Applicat/add_asin_attribute_to_release2

Adds release fields asin, barcode and quality.
This commit is contained in:
Gregory Eremin 2013-01-22 21:55:13 -08:00
commit 5d1eeb009a
4 changed files with 20 additions and 8 deletions

View File

@ -109,7 +109,10 @@ MusicBrainz::Release.find(id)
:status => String,
:format => String,
:date => Date,
:country => String
:country => String,
:asin => String,
:barcode => String,
:quality => String
}
```

View File

@ -9,7 +9,10 @@ module MusicBrainz
title: (xml.xpath('./title').text rescue nil),
status: (xml.xpath('./status').text rescue nil),
country: (xml.xpath('./country').text rescue nil),
date: (xml.xpath('./date').text rescue nil)
date: (xml.xpath('./date').text rescue nil),
asin: (xml.xpath('./asin').text rescue nil),
barcode: (xml.xpath('./barcode').text rescue nil),
quality: (xml.xpath('./quality').text rescue nil)
}
formats = (xml.xpath('./medium-list/medium/format') rescue []).map(&:text)

View File

@ -6,6 +6,9 @@ module MusicBrainz
field :format, String
field :date, Date
field :country, String
field :asin, String
field :barcode, String
field :quality, String
def tracks
@tracks ||= client.load(:release, { id: id, inc: [:recordings, :media], limit: 100 }, {

View File

@ -15,12 +15,15 @@ describe MusicBrainz::Release do
end
it "gets correct release data" do
release = MusicBrainz::Release.find("2225dd4c-ae9a-403b-8ea0-9e05014c778f")
release.id.should == "2225dd4c-ae9a-403b-8ea0-9e05014c778f"
release.title.should == "Empire"
release = MusicBrainz::Release.find("b94cb547-cf7a-4357-894c-53c3bf33b093")
release.id.should == "b94cb547-cf7a-4357-894c-53c3bf33b093"
release.title.should == "Humanoid"
release.status.should == "Official"
release.date.should == Date.new(2006, 8, 28)
release.country.should == "GB"
release.date.should == Date.new(2009, 10, 6)
release.country.should == "US"
release.asin.should == 'B002NOYX6I'
release.barcode.should == '602527197692'
release.quality.should == 'normal'
end
it "gets correct release tracks" do