mirror of
https://github.com/beetbox/beets.git
synced 2025-12-24 17:43:52 +01:00
echonest_tempo: catch IO errors (GC-482)
This commit is contained in:
parent
1809de1500
commit
082932069f
2 changed files with 15 additions and 10 deletions
|
|
@ -71,16 +71,20 @@ def get_tempo(artist, title):
|
|||
)
|
||||
except pyechonest.util.EchoNestAPIError as e:
|
||||
if e.code == 3:
|
||||
# Rate limit exceeded.
|
||||
if i >= RETRIES - 1:
|
||||
# Waited too many times already.
|
||||
log.debug(u'echonest_tempo: exceeded retries')
|
||||
return None
|
||||
else:
|
||||
# Wait and try again.
|
||||
time.sleep(RETRY_INTERVAL)
|
||||
# Wait and try again.
|
||||
time.sleep(RETRY_INTERVAL)
|
||||
else:
|
||||
raise
|
||||
except pyechonest.util.EchoNestIOError as e:
|
||||
log.debug(u'echonest_tempo: IO error: {0}'.format(e))
|
||||
time.sleep(RETRY_INTERVAL)
|
||||
else:
|
||||
break
|
||||
else:
|
||||
# If we exited the loop without breaking, then we used up all
|
||||
# our allotted retries.
|
||||
log.debug(u'echonest_tempo: exceeded retries')
|
||||
return None
|
||||
|
||||
if len(results) > 0:
|
||||
return results[0].audio_summary['tempo']
|
||||
|
|
|
|||
|
|
@ -4,8 +4,9 @@ Changelog
|
|||
1.0rc2 (in development)
|
||||
-----------------------
|
||||
|
||||
* :doc:`/plugins/echonest_tempo`: If the Echo Nest API limit is exceeded, the
|
||||
plugin now waits and tries again instead of crashing. Thanks to Zach Denton.
|
||||
* :doc:`/plugins/echonest_tempo`: If the Echo Nest API limit is exceeded or a
|
||||
communication error occurs, the plugin now waits and tries again instead of
|
||||
crashing. Thanks to Zach Denton.
|
||||
* :doc:`/plugins/fetchart`: Fix a regression that caused crashes when art was
|
||||
not available from some sources.
|
||||
* Fix a regression on Windows that caused all relative paths to be "not found".
|
||||
|
|
|
|||
Loading…
Reference in a new issue