feat: extract featured artists from track title

This commit is contained in:
geoffrey45
2023-01-24 18:53:30 +03:00
parent df6609e7f4
commit 2ba1b0386e
7 changed files with 64 additions and 19 deletions
+11 -7
View File
@@ -58,10 +58,14 @@ class Track:
def __post_init__(self):
if self.artist is not None:
artist_str = str(self.artist).split(", ")
self.artist_hashes = [utils.create_hash(a, decode=True) for a in artist_str]
artists = utils.split_artists(self.artist)
featured = utils.extract_featured_artists_from_title(self.title)
artists.extend(featured)
artists = set(artists)
self.artist = [Artist(a) for a in artist_str]
self.artist_hashes = [utils.create_hash(a, decode=True) for a in artists]
self.artist = [Artist(a) for a in artists]
albumartists = str(self.albumartist).split(", ")
self.albumartist = [Artist(a) for a in albumartists]
@@ -150,10 +154,10 @@ class Album:
Checks if the album is a single.
"""
if (
len(tracks) == 1
and tracks[0].title == self.title
and tracks[0].track == 1
and tracks[0].disc == 1
len(tracks) == 1
and tracks[0].title == self.title
and tracks[0].track == 1
and tracks[0].disc == 1
):
self.is_single = True