mirror of
https://github.com/beetbox/beets.git
synced 2026-01-03 06:22:48 +01:00
fix flake8
This commit is contained in:
parent
117d16f2ad
commit
567e6300fd
2 changed files with 6 additions and 5 deletions
|
|
@ -22,7 +22,6 @@ import urllib
|
|||
import json
|
||||
import unicodedata
|
||||
import difflib
|
||||
import string
|
||||
|
||||
from beets.plugins import BeetsPlugin
|
||||
from beets import ui
|
||||
|
|
@ -306,13 +305,14 @@ def sanitize_lyrics(text):
|
|||
|
||||
return text
|
||||
|
||||
|
||||
def remove_credits(text):
|
||||
"""Remove first/last line of text if it contains the word 'lyrics'
|
||||
eg 'Lyrics by songsdatabase.com'
|
||||
"""
|
||||
textlines = text.split('\n')
|
||||
credits = None
|
||||
for i in (0,-1):
|
||||
for i in (0, -1):
|
||||
if textlines and 'lyrics' in textlines[i].lower():
|
||||
credits = textlines.pop(i)
|
||||
if credits:
|
||||
|
|
@ -343,7 +343,8 @@ def is_lyrics(text, artist=None):
|
|||
badTriggersOcc += [artist]
|
||||
|
||||
for item in badTriggers:
|
||||
badTriggersOcc += [item] * len(re.findall(r'\W%s\W' % item, text, re.I))
|
||||
badTriggersOcc += [item] * len(re.findall(r'\W%s\W' % item,
|
||||
text, re.I))
|
||||
|
||||
if badTriggersOcc:
|
||||
log.debug('Bad triggers detected: %s' % badTriggersOcc)
|
||||
|
|
|
|||
|
|
@ -86,8 +86,8 @@ class LyricsScrapingPluginTest(unittest.TestCase):
|
|||
dict(definfo, url=u'http://www.elyricsworld.com',
|
||||
path=u'/lady_madonna_lyrics_beatles.html'),
|
||||
dict(artist=u'Beres Hammond', title=u'I could beat myself',
|
||||
url=u'http://www.reggaelyrics.info',
|
||||
path=u'/beres-hammond/i-could-beat-myself'),
|
||||
url=u'http://www.reggaelyrics.info',
|
||||
path=u'/beres-hammond/i-could-beat-myself'),
|
||||
dict(definfo, artist=u'Lilly Wood & the prick', title=u"Hey it's ok",
|
||||
url=u'http://www.lyricsmania.com',
|
||||
path=u'/hey_its_ok_lyrics_lilly_wood_and_the_prick.html'),
|
||||
|
|
|
|||
Loading…
Reference in a new issue