From 5be50fbb38546cf476692d446d2493df6443bd0f Mon Sep 17 00:00:00 2001 From: Adrian Sampson Date: Tue, 5 Feb 2013 10:28:24 -0800 Subject: [PATCH] echonest_tempo: skip when missing artist or title --- beetsplug/echonest_tempo.py | 5 +++++ docs/changelog.rst | 2 ++ 2 files changed, 7 insertions(+) diff --git a/beetsplug/echonest_tempo.py b/beetsplug/echonest_tempo.py index 992a1e29e..9ce222ab2 100644 --- a/beetsplug/echonest_tempo.py +++ b/beetsplug/echonest_tempo.py @@ -57,6 +57,11 @@ def fetch_item_tempo(lib, loglevel, item, write): def get_tempo(artist, title): """Get the tempo for a song.""" + # We must have sufficient metadata for the lookup. Otherwise the API + # will just complain. + if not artist or not title: + return None + for i in range(RETRIES): try: # Unfortunately, all we can do is search by artist and title. diff --git a/docs/changelog.rst b/docs/changelog.rst index 01c287d80..159df3cbd 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -57,6 +57,8 @@ Other new stuff: * ReplayGain tags on MPEG-4/AAC files are now supported. Thanks to Dave Hayes. * :doc:`/plugins/bpd`: Browse by album artist and album artist sort name. Thanks to Steinþór Pálsson. +* :doc:`/plugins/echonest_tempo`: Don't attempt a lookup when the artist or + track title is missing. * Fix an error when migrating the ``.beetsstate`` file on Windows. * A nicer error message is now given when the configuration file contains tabs. (YAML doesn't like tabs.)