mirror of
https://github.com/beetbox/beets.git
synced 2025-12-15 21:14:19 +01:00
generalize genius artist matching to use slug()
This commit is contained in:
parent
bb5740d63c
commit
7220c91d2a
1 changed files with 2 additions and 12 deletions
|
|
@ -419,24 +419,14 @@ class Genius(Backend):
|
|||
return None
|
||||
|
||||
for hit in json["response"]["hits"]:
|
||||
hit_artist = self._clean(hit["result"]["primary_artist"]["name"])
|
||||
hit_artist = hit["result"]["primary_artist"]["name"]
|
||||
|
||||
if hit_artist.lower() == artist.lower():
|
||||
if slug(hit_artist) == slug(artist):
|
||||
return self.lyrics_from_song_page(hit["result"]["url"])
|
||||
|
||||
self._log.debug(u'Genius failed to find a matching artist for \'{0}\'',
|
||||
artist)
|
||||
|
||||
def _clean(self, artist):
|
||||
"""Cleans genius-isms to help artist matching"""
|
||||
# Genius uses zero-width characters to denote lowercase artist names
|
||||
artist = artist.strip(u'\u200b')
|
||||
|
||||
# Genius uses minus-hypen compared to beets hyphen
|
||||
artist = artist.replace(u'\u002D', u'\u2010')
|
||||
|
||||
return artist
|
||||
|
||||
|
||||
class LyricsWiki(SymbolsReplaced):
|
||||
"""Fetch lyrics from LyricsWiki."""
|
||||
|
|
|
|||
Loading…
Reference in a new issue