From deadc4d04964d1b1d71fff132a3aafcfe4ff1bfe Mon Sep 17 00:00:00 2001 From: Lachlan Charlick Date: Mon, 28 Dec 2015 23:57:03 +1030 Subject: [PATCH] fetchart: Automatically disable google backend if no API key is set --- beetsplug/fetchart.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/beetsplug/fetchart.py b/beetsplug/fetchart.py index 66273a3df..297db5d0d 100644 --- a/beetsplug/fetchart.py +++ b/beetsplug/fetchart.py @@ -169,9 +169,6 @@ class GoogleImages(ArtSource): engine_id = config['fetchart']['google_engine_ID'].get() self._log.debug('API Key: ' + api_key) self._log.debug('Engine ID: ' + engine_id) - if not api_key: - self._log.debug(u'google api key not set') - return if not (album.albumartist and album.album): return search_string = (album.albumartist + ',' + album.album).encode('utf-8') @@ -446,6 +443,9 @@ class FetchArtPlugin(plugins.BeetsPlugin, RequestMixin): available_sources = list(SOURCES_ALL) if not HAVE_ITUNES and u'itunes' in available_sources: available_sources.remove(u'itunes') + if not self.config['google_API_key'].get() and \ + u'google' in available_sources: + available_sources.remove(u'google') sources_name = plugins.sanitize_choices( self.config['sources'].as_str_seq(), available_sources) self.sources = [ART_SOURCES[s](self._log) for s in sources_name]