mirror of
https://github.com/beetbox/beets.git
synced 2025-12-06 16:42:42 +01:00
fix genius lyrics artist matching when artist contains a hyphen
This commit is contained in:
parent
31855a9394
commit
ae175e156b
1 changed files with 12 additions and 5 deletions
|
|
@ -419,16 +419,23 @@ class Genius(Backend):
|
|||
return None
|
||||
|
||||
for hit in json["response"]["hits"]:
|
||||
# Genius uses zero-width characters to denote lowercase
|
||||
# artist names.
|
||||
hit_artist = hit["result"]["primary_artist"]["name"]. \
|
||||
strip(u'\u200b').lower()
|
||||
hit_artist = self._clean(hit["result"]["primary_artist"]["name"])
|
||||
|
||||
if hit_artist == artist.lower():
|
||||
if hit_artist.lower() == artist.lower():
|
||||
return self.lyrics_from_song_page(hit["result"]["url"])
|
||||
|
||||
self._log.debug(u'genius: no matching 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