fetchart: Tidier google backend configuration keys

This commit is contained in:
Lachlan Charlick 2015-12-30 13:34:58 +10:30
parent e771f34dfd
commit 0d16f764f2
2 changed files with 10 additions and 10 deletions

View file

@ -169,8 +169,8 @@ class GoogleImages(ArtSource):
return
search_string = (album.albumartist + ',' + album.album).encode('utf-8')
response = self.request(self.URL, params={
'key': self._config['google_API_key'].get(),
'cx': self._config['google_engine_ID'].get(),
'key': self._config['google_key'].get(),
'cx': self._config['google_engine'].get(),
'q': search_string,
'searchType': 'image'
})
@ -424,10 +424,10 @@ class FetchArtPlugin(plugins.BeetsPlugin, RequestMixin):
'cautious': False,
'cover_names': ['cover', 'front', 'art', 'album', 'folder'],
'sources': ['coverart', 'itunes', 'amazon', 'albumart'],
'google_API_key': None,
'google_engine_ID': u'001442825323518660753:hrh5ch1gjzm',
'google_key': None,
'google_engine': u'001442825323518660753:hrh5ch1gjzm',
})
self.config['google_API_key'].redact = True
self.config['google_key'].redact = True
# Holds paths to downloaded images between fetching them and
# placing them in the filesystem.
@ -445,7 +445,7 @@ 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 \
if not self.config['google_key'].get() and \
u'google' in available_sources:
available_sources.remove(u'google')
sources_name = plugins.sanitize_choices(

View file

@ -52,10 +52,10 @@ file. The available options are:
Default: ``coverart itunes amazon albumart``, i.e., everything but
``wikipedia`` and ``google``. Enable those two sources for more matches at
the cost of some speed.
- **google_API_key**: Your Google API key (to enable the Google Custom Search
- **google_key**: Your Google API key (to enable the Google Custom Search
backend).
Default: None.
- **google_engine_ID**: The custom search engine to use.
- **google_engine**: The custom search engine to use.
Default: The `beets custom search engine`_, which searches the entire web.
Note: ``minwidth`` and ``enforce_ratio`` options require either `ImageMagick`_
@ -147,14 +147,14 @@ Google custom search
''''''''''''''''''''
To use the google image search backend you need to
`register for a Google API key`_. Set the ``google_API_key`` configuration
`register for a Google API key`_. Set the ``google_key`` configuration
option to your key, then add ``google`` to the list of sources in your
configuration.
.. _register for a Google API key: https://code.google.com/apis/console.
Optionally, you can `define a custom search engine`_. Get your search engine's
token and use it for your ``google_engine_ID`` configuration option. The
token and use it for your ``google_engine`` configuration option. The
default engine searches the entire web for cover art.
.. _define a custom search engine: http://www.google.com/cse/all