Skip to content

Commit

Permalink
fix: group by artist name w/ normalized apostroph
Browse files Browse the repository at this point in the history
  • Loading branch information
mgoltzsche committed Mar 22, 2024
1 parent 7e94e8e commit a05bcda
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion beetsplug/webm3u/playlist.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def _sortedartists(artists):

class Artist:
def __init__(self, name):
self.key = _strip_accents(name.lower())
self.key = _normalize(name.lower())
self.name = name
self.count = 1

Expand Down Expand Up @@ -137,5 +137,16 @@ def __init__(self):
self.uri = None
self.attrs = None

def normalize(s):
s = strip_accents(s)
s = normalize_apostroph(s)
return s

def normalize_apostroph(s):
return s.replace('’', "'")

def strip_accents(s):
return ''.join(c for c in unicodedata.normalize('NFD', s) if unicodedata.category(c) != 'Mn')

def _strip_accents(s):
return ''.join(c for c in unicodedata.normalize('NFD', s) if unicodedata.category(c) != 'Mn')

0 comments on commit a05bcda

Please sign in to comment.