Sha256: a3527a94d0c5383254702790113b9f7fa932b31aef2a7f3acbeb903977a06d3c
Contents?: true
Size: 553 Bytes
Versions: 1
Compression:
Stored size: 553 Bytes
Contents
module MusicBrainz @@last_query_time = 0 @@query_interval = 1.1 def self.load url sleep @@query_interval - (Time.now.to_f - @@last_query_time) if Time.now.to_f - @@last_query_time < @@query_interval response = nil 5.times do begin response = open(url, "User-Agent" => "gem musicbrainz (https://github.com/magnolia-fan/musicbrainz) @ " + Socket.gethostname) @@last_query_time = Time.now.to_f rescue => e p "MusicBrainz: 503" end break unless response.nil? end response end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
musicbrainz-0.4.1 | lib/models/music_brainz.rb |