Skip to content

Commit

Permalink
Fix non deterministic behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
desbma committed Jun 5, 2020
1 parent 4ab874c commit 92309dd
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
17 changes: 9 additions & 8 deletions amg/tag.py
Expand Up @@ -11,6 +11,7 @@
import string
from typing import Dict, List, Optional, Sequence

import more_itertools
import mutagen
import unidecode

Expand Down Expand Up @@ -385,14 +386,14 @@ def doKeep(self) -> bool:

def cleanup(self, title: str, artist: str) -> str:
""" See TitleCleanerBase.cleanup. """
artist_variants = tuple(frozenset((f"{artist} band",
artist,
artist.replace(" ", ""),
artist.replace("and", "&"),
artist.replace("&", "and"),
artist.replace(", ", " and "),
artist.replace(" and ", ", "),
artist.replace("’", ""))))
artist_variants = tuple(more_itertools.unique_everseen((f"{artist} band",
artist,
artist.replace(" ", ""),
artist.replace("and", "&"),
artist.replace("&", "and"),
artist.replace(", ", " and "),
artist.replace(" and ", ", "),
artist.replace("’", ""))))
for s, suffix_only in itertools.zip_longest(("by " + artist,) + artist_variants,
(True,),
fillvalue=False):
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Expand Up @@ -2,6 +2,7 @@ appdirs>=1.4.3
cssselect>=1.0.3
curses-menu==0.5.0
lxml>=4.3.3
more_itertools>=8.3.0
mutagen>=1.42.0
Pillow>=6.0.0
r128gain>=1.0.1
Expand Down

0 comments on commit 92309dd

Please sign in to comment.