Sha256: a3d5e69bda828533058255a0010462a99244c3bddfdb73eaf714a943327b58ef
Contents?: true
Size: 804 Bytes
Versions: 1
Compression:
Stored size: 804 Bytes
Contents
module MusicBrainz @@last_query_time = 0 def self.last_query_time @@last_query_time end def self.last_query_time= time @@last_query_time = time end def self.load url sleep 1.1 - (Time.now.to_f - self.last_query_time) if Time.now.to_f - self.last_query_time < 1.1 response = nil 5.times do begin response = open(url, "User-Agent" => "gem musicbrainz (https://github.com/magnolia-fan/musicbrainz) @ " + Socket.gethostname) self.last_query_time = Time.now.to_f rescue => e p "MusicBrainz: 503" end break unless response.nil? end response end def self.discography mbid artist = MusicBrainz::Artist.find(mbid) artist.release_groups.each {|rg| rg.releases.each {|r| r.tracks } } artist end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
musicbrainz-0.4.0 | lib/models/music_brainz.rb |