Skip to content

Commit

Permalink
Handle more exceptions in title tag normalization code - 46
Browse files Browse the repository at this point in the history
  • Loading branch information
desbma committed Nov 28, 2017
1 parent a544008 commit bcf9e3c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
4 changes: 2 additions & 2 deletions amg/tag.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,9 @@ def rmprefix(s, e):
loop = True

# detect and remove '- xxx metal' suffix
for genre in ("metal", "grind"):
for genre in ("metal", "grindcore", "grind"):
if endslike(title, genre): # performance optimization
match = re.search("[\-|\(\[/]+[ ]*(?:[a-z/-]+[ ]*)+" + genre + "$",
match = re.search("[\-|\(\[/]+[ ]*(?:[0-9a-z/-]+[ ]*)+" + genre + "$",
title.rstrip(string.punctuation),
re.IGNORECASE)
if match:
Expand Down
6 changes: 5 additions & 1 deletion tests/test_tag.py
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,11 @@ def test_normalize_title_tag(self):
("THREAT SIGNAL - Elimination Process (Official 360 VR Video)",
"Threat Signal",
"Disconnect",
"Elimination Process"))
"Elimination Process"),
("Death Toll 80k - Cause / Avoid (2017 - Grindcore)",
"Death Toll 80k",
"Step Down",
"Cause / Avoid"))

for before, artist, album, after in references:
self.assertEqual(amg.tag.normalize_title_tag(before, artist, album), after)
Expand Down

0 comments on commit bcf9e3c

Please sign in to comment.