mirror of
https://github.com/beetbox/beets.git
synced 2025-12-24 01:25:47 +01:00
Code review
This commit is contained in:
parent
1266a04998
commit
58bfe4567e
2 changed files with 9 additions and 24 deletions
|
|
@ -678,7 +678,7 @@ class Google(Backend):
|
|||
|
||||
class LyricsPlugin(plugins.BeetsPlugin):
|
||||
SOURCES = ['google', 'lyricwiki', 'musixmatch', 'genius', 'tekstowo']
|
||||
SOURCES_USING_BEAUTIFUL_SOUP = ['google', 'genius', 'tekstowo']
|
||||
BS_SOURCES = ['google', 'genius', 'tekstowo']
|
||||
SOURCE_BACKENDS = {
|
||||
'google': Google,
|
||||
'lyricwiki': LyricsWiki,
|
||||
|
|
@ -724,7 +724,7 @@ class LyricsPlugin(plugins.BeetsPlugin):
|
|||
self.config['sources'].as_str_seq(), available_sources)
|
||||
|
||||
if not HAS_BEAUTIFUL_SOUP:
|
||||
sources = self.sanitize_beautiful_soup_sources(sources)
|
||||
sources = self.sanitize_bs_sources(sources)
|
||||
|
||||
if 'google' in sources:
|
||||
if not self.config['google_API_key'].get():
|
||||
|
|
@ -748,8 +748,8 @@ class LyricsPlugin(plugins.BeetsPlugin):
|
|||
self.backends = [self.SOURCE_BACKENDS[source](self.config, self._log)
|
||||
for source in sources]
|
||||
|
||||
def sanitize_beautiful_soup_sources(self, sources):
|
||||
for source in self.SOURCES_USING_BEAUTIFUL_SOUP:
|
||||
def sanitize_bs_sources(self, sources):
|
||||
for source in self.BS_SOURCES:
|
||||
if source in sources:
|
||||
self._log.warning(u'To use the %s lyrics source, you must '
|
||||
u'install the beautifulsoup4 module. See '
|
||||
|
|
|
|||
|
|
@ -129,11 +129,6 @@ few suggestions.
|
|||
Activate Google Custom Search
|
||||
------------------------------
|
||||
|
||||
Using the Google backend requires `BeautifulSoup`_, which you can install
|
||||
using `pip`_ by typing::
|
||||
|
||||
pip install beautifulsoup4
|
||||
|
||||
You also need to `register for a Google API key`_. Set the ``google_API_key``
|
||||
configuration option to your key.
|
||||
Then add ``google`` to the list of sources in your configuration (or use
|
||||
|
|
@ -156,25 +151,15 @@ After that, the lyrics plugin will fall back on other declared data sources.
|
|||
.. _pip: https://pip.pypa.io
|
||||
.. _BeautifulSoup: https://www.crummy.com/software/BeautifulSoup/bs4/doc/
|
||||
|
||||
Activate Genius Lyrics
|
||||
----------------------
|
||||
Installing BeautifulSoup for Google, Genius, or Tekstowo.pl Backends
|
||||
--------------------------------------------------------------------
|
||||
|
||||
Like the Google backend, the Genius backend requires the `BeautifulSoup`_
|
||||
library. Install it by typing::
|
||||
Using the Google, Genius, or Tekstowo.pl backends requires `BeautifulSoup`_,
|
||||
which you can install using `pip`_ by typing::
|
||||
|
||||
pip install beautifulsoup4
|
||||
|
||||
The backend is enabled by default.
|
||||
|
||||
Activate Tekstowo.pl Lyrics
|
||||
----------------------
|
||||
|
||||
Like the Google backend, the Tekstowo.pl backend requires the `BeautifulSoup`_
|
||||
library. Install it by typing::
|
||||
|
||||
pip install beautifulsoup4
|
||||
|
||||
The backend is enabled by default.
|
||||
These backends are enabled by default.
|
||||
|
||||
.. _lyrics-translation:
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue