Skip to content

Commit faf8be0

Browse files
committed
Merge pull request #2549 from Kraymer/drop-lyrics-com
Drop lyrics.com backend
2 parents 376c31a + 6fa1651 commit faf8be0

File tree

4 files changed

+4
-39
lines changed

4 files changed

+4
-39
lines changed

beetsplug/lyrics.py

Lines changed: 1 addition & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -381,39 +381,6 @@ def fetch(self, artist, title):
381381
return lyrics
382382

383383

384-
class LyricsCom(Backend):
385-
"""Fetch lyrics from Lyrics.com."""
386-
387-
URL_PATTERN = 'http://www.lyrics.com/%s-lyrics-%s.html'
388-
NOT_FOUND = (
389-
'Sorry, we do not have the lyric',
390-
'Submit Lyrics',
391-
)
392-
393-
@classmethod
394-
def _encode(cls, s):
395-
s = re.sub(r'[^\w\s-]', '', s)
396-
s = re.sub(r'\s+', '-', s)
397-
return super(LyricsCom, cls)._encode(s).lower()
398-
399-
def fetch(self, artist, title):
400-
url = self.build_url(artist, title)
401-
html = self.fetch_url(url)
402-
if not html:
403-
return
404-
lyrics = extract_text_between(html, '<div id="lyrics" class="SCREENO'
405-
'NLY" itemprop="description">', '</div>')
406-
if not lyrics:
407-
return
408-
for not_found_str in self.NOT_FOUND:
409-
if not_found_str in lyrics:
410-
return
411-
412-
parts = lyrics.split('\n---\nLyrics powered by', 1)
413-
if parts:
414-
return parts[0]
415-
416-
417384
def remove_credits(text):
418385
"""Remove first/last line of text if it contains the word 'lyrics'
419386
eg 'Lyrics by songsdatabase.com'
@@ -605,11 +572,10 @@ def fetch(self, artist, title):
605572

606573

607574
class LyricsPlugin(plugins.BeetsPlugin):
608-
SOURCES = ['google', 'lyricwiki', 'lyrics.com', 'musixmatch']
575+
SOURCES = ['google', 'lyricwiki', 'musixmatch']
609576
SOURCE_BACKENDS = {
610577
'google': Google,
611578
'lyricwiki': LyricsWiki,
612-
'lyrics.com': LyricsCom,
613579
'musixmatch': MusiXmatch,
614580
'genius': Genius,
615581
}

docs/changelog.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ Fixes:
105105
to adopt it? :bug:`2371` :bug:`1610`
106106
* :doc:`/plugins/web`: Avoid a crash when sending binary data, such as
107107
Chromaprint fingerprints, in music attributes. :bug:`2542` :bug:`2532`
108+
* :doc:`/plugins/lyrics`: drop Lyrics.com backend (don't work anymore)
108109

109110
.. _python-itunes: https://github.com/ocelma/python-itunes
110111

docs/plugins/lyrics.rst

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,10 @@ Lyrics Plugin
22
=============
33

44
The ``lyrics`` plugin fetches and stores song lyrics from databases on the Web.
5-
Namely, the current version of the plugin uses `Lyric Wiki`_, `Lyrics.com`_,
5+
Namely, the current version of the plugin uses `Lyric Wiki`_,
66
`Musixmatch`_, `Genius.com`_, and, optionally, the Google custom search API.
77

88
.. _Lyric Wiki: http://lyrics.wikia.com/
9-
.. _Lyrics.com: http://www.lyrics.com/
109
.. _Musixmatch: https://www.musixmatch.com/
1110
.. _Genius.com: http://genius.com/
1211

@@ -60,7 +59,7 @@ configuration file. The available options are:
6059
sources known to be scrapeable.
6160
- **sources**: List of sources to search for lyrics. An asterisk ``*`` expands
6261
to all available sources.
63-
Default: ``google lyricwiki lyrics.com musixmatch``, i.e., all the
62+
Default: ``google lyricwiki musixmatch``, i.e., all the
6463
sources except for `genius`. The `google` source will be automatically
6564
deactivated if no ``google_API_key`` is setup.
6665

test/test_lyrics.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,6 @@ class LyricsPluginSourcesTest(LyricsGoogleBaseTest):
246246

247247
DEFAULT_SOURCES = [
248248
dict(DEFAULT_SONG, backend=lyrics.LyricsWiki),
249-
dict(DEFAULT_SONG, backend=lyrics.LyricsCom),
250249
dict(artist=u'Santana', title=u'Black magic woman',
251250
backend=lyrics.MusiXmatch),
252251
dict(DEFAULT_SONG, backend=lyrics.Genius),

0 commit comments

Comments
 (0)