Skip to content

Commit

Permalink
Handle more exceptions in title tag normalization code - 67
Browse files Browse the repository at this point in the history
  • Loading branch information
desbma committed Jul 17, 2018
1 parent c27dfa9 commit 0b6b4c0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 13 deletions.
3 changes: 3 additions & 0 deletions amg/tag.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,9 @@ def __init__(self, artist, album):
# fix paired chars
self.registerCleaner(PairedCharCleaner(execute_once=True))

# remove some punctuation
self.registerCleaner(FunctionCleaner(lambda x: x.strip("-"), execute_once=True))

# normalize case
self.registerCleaner(FunctionCleaner(sanitize.normalize_tag_case, execute_once=True))

Expand Down
18 changes: 5 additions & 13 deletions tests/test_tag.py
Original file line number Diff line number Diff line change
Expand Up @@ -306,18 +306,6 @@ def test_normalize_title_tag(self):
"Stallion",
"From the Dead",
"Waiting for a Sign"),
("Dystopia -Vanishing Point-",
"Boris",
"Dear",
"Dystopia -Vanishing Point-"),
("DEADSONG",
"Boris",
"Dear",
"Deadsong"),
("D.O.W.N -Domination of Waiting Noise-",
"Boris",
"Dear",
"D.O.W.N -Domination of Waiting Noise-"),
("OBSCURITY - WAS UNS BLEIBT (OFFICIAL LYRIC VIDEO) | TROLLZORN",
"Obscurity",
"Streitmacht",
Expand Down Expand Up @@ -489,7 +477,11 @@ def test_normalize_title_tag(self):
("ABSTRACTER - Ashen Reign (2018) I, Voidhanger Records/Sentient Ruin Laboratories/Daymare Recordings",
"Abstracter",
"Cinereous Incarnate",
"Ashen Reign"))
"Ashen Reign"),
("SECRET CUTTER - Trampled By Light --LYRIC VIDEO--",
"Secret Cutter",
"Quantum Eraser",
"Trampled by Light"))

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 0b6b4c0

Please sign in to comment.