Skip to content

Commit

Permalink
Handle more exceptions in title tag normalization code - 57
Browse files Browse the repository at this point in the history
  • Loading branch information
desbma committed Mar 8, 2018
1 parent fd6a655 commit 6b0a257
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
4 changes: 3 additions & 1 deletion amg/tag.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,9 @@ class SimpleSuffixCleaner(TitleCleanerBase):
def cleanup(self, title, suffix):
""" See TitleCleanerBase.cleanup. """
if self.endslike(title, suffix):
title = self.rclean(self.rmsuffix(title, suffix))
new_title = self.rclean(self.rmsuffix(title, suffix))
if new_title.lower() != "the":
title = new_title
return title


Expand Down
6 changes: 5 additions & 1 deletion tests/test_tag.py
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,11 @@ def test_normalize_title_tag(self):
("ARMORED DAWN - Barbarians In Black // Album Trailer (2018) // AFM Records",
"Armored Dawn",
"Barbarians in Black",
"Barbarians in Black"))
"Barbarians in Black"),
("Conjurer - The Mire (Official Video)",
"Conjurer",
"Mire",
"The Mire"))

for source, artist, album, expected_result in references:
with self.subTest(source=source, expected_result=expected_result, artist=artist, album=album):
Expand Down

0 comments on commit 6b0a257

Please sign in to comment.