mirror of
https://github.com/beetbox/beets.git
synced 2025-12-24 17:43:52 +01:00
Merge pull request #2549 from Kraymer/drop-lyrics-com
Drop lyrics.com backend
This commit is contained in:
commit
faf8be089b
4 changed files with 4 additions and 39 deletions
|
|
@ -381,39 +381,6 @@ class LyricsWiki(SymbolsReplaced):
|
|||
return lyrics
|
||||
|
||||
|
||||
class LyricsCom(Backend):
|
||||
"""Fetch lyrics from Lyrics.com."""
|
||||
|
||||
URL_PATTERN = 'http://www.lyrics.com/%s-lyrics-%s.html'
|
||||
NOT_FOUND = (
|
||||
'Sorry, we do not have the lyric',
|
||||
'Submit Lyrics',
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def _encode(cls, s):
|
||||
s = re.sub(r'[^\w\s-]', '', s)
|
||||
s = re.sub(r'\s+', '-', s)
|
||||
return super(LyricsCom, cls)._encode(s).lower()
|
||||
|
||||
def fetch(self, artist, title):
|
||||
url = self.build_url(artist, title)
|
||||
html = self.fetch_url(url)
|
||||
if not html:
|
||||
return
|
||||
lyrics = extract_text_between(html, '<div id="lyrics" class="SCREENO'
|
||||
'NLY" itemprop="description">', '</div>')
|
||||
if not lyrics:
|
||||
return
|
||||
for not_found_str in self.NOT_FOUND:
|
||||
if not_found_str in lyrics:
|
||||
return
|
||||
|
||||
parts = lyrics.split('\n---\nLyrics powered by', 1)
|
||||
if parts:
|
||||
return parts[0]
|
||||
|
||||
|
||||
def remove_credits(text):
|
||||
"""Remove first/last line of text if it contains the word 'lyrics'
|
||||
eg 'Lyrics by songsdatabase.com'
|
||||
|
|
@ -605,11 +572,10 @@ class Google(Backend):
|
|||
|
||||
|
||||
class LyricsPlugin(plugins.BeetsPlugin):
|
||||
SOURCES = ['google', 'lyricwiki', 'lyrics.com', 'musixmatch']
|
||||
SOURCES = ['google', 'lyricwiki', 'musixmatch']
|
||||
SOURCE_BACKENDS = {
|
||||
'google': Google,
|
||||
'lyricwiki': LyricsWiki,
|
||||
'lyrics.com': LyricsCom,
|
||||
'musixmatch': MusiXmatch,
|
||||
'genius': Genius,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -105,6 +105,7 @@ Fixes:
|
|||
to adopt it? :bug:`2371` :bug:`1610`
|
||||
* :doc:`/plugins/web`: Avoid a crash when sending binary data, such as
|
||||
Chromaprint fingerprints, in music attributes. :bug:`2542` :bug:`2532`
|
||||
* :doc:`/plugins/lyrics`: drop Lyrics.com backend (don't work anymore)
|
||||
|
||||
.. _python-itunes: https://github.com/ocelma/python-itunes
|
||||
|
||||
|
|
|
|||
|
|
@ -2,11 +2,10 @@ Lyrics Plugin
|
|||
=============
|
||||
|
||||
The ``lyrics`` plugin fetches and stores song lyrics from databases on the Web.
|
||||
Namely, the current version of the plugin uses `Lyric Wiki`_, `Lyrics.com`_,
|
||||
Namely, the current version of the plugin uses `Lyric Wiki`_,
|
||||
`Musixmatch`_, `Genius.com`_, and, optionally, the Google custom search API.
|
||||
|
||||
.. _Lyric Wiki: http://lyrics.wikia.com/
|
||||
.. _Lyrics.com: http://www.lyrics.com/
|
||||
.. _Musixmatch: https://www.musixmatch.com/
|
||||
.. _Genius.com: http://genius.com/
|
||||
|
||||
|
|
@ -60,7 +59,7 @@ configuration file. The available options are:
|
|||
sources known to be scrapeable.
|
||||
- **sources**: List of sources to search for lyrics. An asterisk ``*`` expands
|
||||
to all available sources.
|
||||
Default: ``google lyricwiki lyrics.com musixmatch``, i.e., all the
|
||||
Default: ``google lyricwiki musixmatch``, i.e., all the
|
||||
sources except for `genius`. The `google` source will be automatically
|
||||
deactivated if no ``google_API_key`` is setup.
|
||||
|
||||
|
|
|
|||
|
|
@ -246,7 +246,6 @@ class LyricsPluginSourcesTest(LyricsGoogleBaseTest):
|
|||
|
||||
DEFAULT_SOURCES = [
|
||||
dict(DEFAULT_SONG, backend=lyrics.LyricsWiki),
|
||||
dict(DEFAULT_SONG, backend=lyrics.LyricsCom),
|
||||
dict(artist=u'Santana', title=u'Black magic woman',
|
||||
backend=lyrics.MusiXmatch),
|
||||
dict(DEFAULT_SONG, backend=lyrics.Genius),
|
||||
|
|
|
|||
Loading…
Reference in a new issue