Uses the MusicBrainz XML Web Service (version 2) to extract the releases for an artist and turn them into nice ruby objects.
require 'rubygems' require 'brainz_releases' releases = BrainzReleases.search do |search| search.user_agent = "YourAppName/x.x" # Required – A string to identify your requests containing your app name and version number (this is required by the MusicBrainz API) search.mbid = "9f9953f0-68bb-4ce3-aace-2f44c87f0aa3" # MusicBrainz artist ID search.name = "Bonobo" # Optional – Only necessary if you don't know the MusicBrainz ID search.start_date = Date.parse("1/1/2011") # Optional – defaults to 1 month ago search.end_date = Date.parse("5/5/2011") # Optional – defaults to 1 month in the future end release = releases.first # A BrainzReleases::Release object has a number of methods to easily access the attributes returned by the MusicBrainz api # For example... release.title # => "Fi" release.date_available # => "2005-02-08" release.release_type # => "Album" release.label # => "Mush Records" release.format # => "CD" release.track_count # => "17" release.country # => "US" release.mbid # => "4a46ee61-75b5-4e2b-ac2e-81ef2ccec0f9" release.artist_name # => "Bibio" release.artist_mbid # => "9f9953f0-68bb-4ce3-aace-2f44c87f0aa3"
The MusicBrainz Web Service allows only ONE web service request per second. This gem DOES NOT implement any time based delay and takes no responsibility if you abuse the request limit.
gem install brainz_releases