show artist decade in genres

+ assign default artist separators if db is empty
+ add instrumental to album version
+ check if album is a single by checking og_title and current title
+ hard code juice wrld artist name in model
+ set album aritst to first artist if track has no album artist
+ rewrite get_base_album_title regex to use existing album versions
+ misc
This commit is contained in:
mungai-njoroge
2023-09-04 11:01:03 +03:00
parent 5ff3e5d28a
commit 83bbe69550
9 changed files with 93 additions and 54 deletions
+8 -6
View File
@@ -173,8 +173,10 @@ class Album:
if (
len(tracks) == 1
and create_hash(tracks[0].title)
== create_hash(self.title) # if they have the same title
and (
create_hash(tracks[0].title) == create_hash(self.title)
or create_hash(tracks[0].title) == create_hash(self.og_title)
) # if they have the same title
# and tracks[0].track == 1
# and tracks[0].disc == 1
# TODO: Review -> Are the above commented checks necessary?
@@ -191,10 +193,10 @@ class Album:
if self.date:
return
dates = {int(t.date) for t in tracks if t.date}
dates = (int(t.date) for t in tracks if t.date)
if len(dates) == 0:
self.date = 0
return
# if len(dates) == 0:
# self.date = 0
# return
self.date = datetime.datetime.fromtimestamp(min(dates)).year
+4
View File
@@ -19,6 +19,10 @@ class ArtistMinimal:
self.artisthash = create_hash(self.name, decode=True)
self.image = self.artisthash + ".webp"
# hack to override all the variations from unreleased files (sorry guys!)
if self.artisthash == "5a37d5315e":
self.name = "Juice WRLD"
@dataclass(slots=True)
class Artist(ArtistMinimal):
+10 -6
View File
@@ -64,6 +64,16 @@ class Track:
[a for a in featured if create_hash(a) not in original_lower]
)
self.artist_hashes = "-".join(create_hash(a, decode=True) for a in artists)
self.artists = [ArtistMinimal(a) for a in artists]
albumartists = split_artists(self.albumartists)
if not albumartists:
self.albumartists = self.artists[:1]
else:
self.albumartists = [ArtistMinimal(a) for a in albumartists]
if get_flag(SessionVarKeys.REMOVE_PROD):
new_title = remove_prod(new_title)
@@ -84,12 +94,6 @@ class Track:
if get_flag(SessionVarKeys.MERGE_ALBUM_VERSIONS):
self.recreate_albumhash()
self.artist_hashes = "-".join(create_hash(a, decode=True) for a in artists)
self.artists = [ArtistMinimal(a) for a in artists]
albumartists = split_artists(self.albumartists)
self.albumartists = [ArtistMinimal(a) for a in albumartists]
self.image = self.albumhash + ".webp"
if self.genre is not None and self.genre != "":