lib/echonest/api.rb in youpy-ruby-echonest-0.0.3 vs lib/echonest/api.rb in youpy-ruby-echonest-0.0.4
- old
+ new
@@ -157,9 +157,14 @@
begin
response = request(method, :md5 => md5)
block.call(response)
+ rescue Echonest::Api::Error => e
+ if e.message =~ /Analysis not ready/
+ sleep 20 # wait for serverside analysis
+ get_trackinfo(method, filename, &block)
+ end
rescue Error => e
if e.message == 'Invalid parameter: unknown MD5 file hash'
upload(filename)
sleep 60 # wait for serverside analysis
get_trackinfo(method, filename, &block)