From 5b71b95d662ea9a51af7ef80da791bc5cfce766c Mon Sep 17 00:00:00 2001 From: geoffrey45 Date: Wed, 25 Jan 2023 09:41:07 +0300 Subject: [PATCH] prevent different cased featured artist names. remove "/" as artist separator --- app/models.py | 5 +++-- app/utils.py | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/app/models.py b/app/models.py index a16cad67..f5e57790 100644 --- a/app/models.py +++ b/app/models.py @@ -59,9 +59,10 @@ class Track: def __post_init__(self): if self.artist is not None: artists = utils.split_artists(self.artist) + featured = utils.extract_featured_artists_from_title(self.title) - artists.extend(featured) - artists = set(artists) + original_lower = "-".join([a.lower() for a in artists]) + artists.extend([a for a in featured if a.lower() not in original_lower]) self.artist_hashes = [utils.create_hash(a, decode=True) for a in artists] diff --git a/app/utils.py b/app/utils.py index 95d78869..8be18367 100644 --- a/app/utils.py +++ b/app/utils.py @@ -260,7 +260,7 @@ def is_windows(): def split_artists(src: str): - artists = re.split(r"\s*[&,;/]\s*", src) + artists = re.split(r"\s*[&,;]\s*", src) return [a.strip() for a in artists]