diff --git a/beetsplug/echoplus.py b/beetsplug/echoplus.py index 83505f06c..2386a68f3 100644 --- a/beetsplug/echoplus.py +++ b/beetsplug/echoplus.py @@ -52,7 +52,7 @@ def _picker(value, rang, mapping): return m # in case of floating point precision problems def _mapping(mapstr): - """Split mapstr at comma and return the stripped values as array.""" + """Split mapstr at comma and returned the stripped values as array.""" return [ m.strip() for m in mapstr.split(u',') ] def _guess_mood(valence, energy): @@ -105,7 +105,7 @@ def fetch_item_attributes(lib, item, write, force, reapply): log.debug(u'echoplus: {} - {} [{}] force:{} reapply:{}'.format( item.artist, item.title, item.length, force, reapply)) - # permanently store the raw values? not supported yet + # permanently store the raw values? store_raw = config['echoplus']['store_raw'].get(bool) # if we want to set mood, we need to make sure, that valence and energy @@ -156,8 +156,7 @@ def fetch_item_attributes(lib, item, write, force, reapply): reapply = True # (re-)fetch audio_summary and store it to the raw values. if we do - # not want to keep the raw values, we clean them up later (not - # implemented yet) + # not want to keep the raw values, we clean them up later audio_summary = get_audio_summary(item.artist, item.title, item.length, allow_upload, item.path) @@ -287,20 +286,22 @@ def get_audio_summary(artist, title, duration, upload, path): if (not pick or min_distance > 1.0) and upload: log.debug(u'echoplus: uploading file "{}" to EchoNest'.format(path)) - t = _echonest_fun(pyechonest.track.track_from_filename, filename=path) - if t: - log.debug(u'echoplus: track {} - {} [{:2.2f}]'.format(t.artist, t.title, - t.duration)) - # FIXME: maybe make pyechonest "nicer"? - result = {} - result['energy'] = t.energy - result['liveness'] = t.liveness - result['speechiness'] = t.speechiness - result['acousticness'] = t.acousticness - result['danceability'] = t.danceability - result['valence'] = t.valence - result['tempo'] = t.tempo - return result + # FIXME: same loop as above... make this better + for i in range(RETRIES): + t = _echonest_fun(pyechonest.track.track_from_filename, filename=path) + if t: + log.debug(u'echoplus: track {} - {} [{:2.2f}]'.format(t.artist, t.title, + t.duration)) + # FIXME: maybe make pyechonest "nicer"? + result = {} + result['energy'] = t.energy + result['liveness'] = t.liveness + result['speechiness'] = t.speechiness + result['acousticness'] = t.acousticness + result['danceability'] = t.danceability + result['valence'] = t.valence + result['tempo'] = t.tempo + return result elif not pick: return None return pick.audio_summary diff --git a/docs/faq.rst b/docs/faq.rst index f7d516bec..4408e0c50 100644 --- a/docs/faq.rst +++ b/docs/faq.rst @@ -202,9 +202,9 @@ Why does beets… There are a number of possibilities: - First, make sure the album is in `the MusicBrainz - database `__. You can search on their site to make - sure it's cataloged there. (If not, anyone can edit MusicBrainz---so - consider adding the data yourself.) + database `__ the MusicBrainz database. You + can search on their site to make sure it's cataloged there. (If not, + anyone can edit MusicBrainz---so consider adding the data yourself.) - If the album in question is a multi-disc release, see the relevant FAQ answer above. - The music files' metadata might be insufficient. Try using the "enter