implement merging album versions

+ add "limit" parameter to the useBisection function
+
This commit is contained in:
geoffrey45
2023-05-09 15:18:30 +03:00
parent f6dc28f80d
commit 8e59a59ba2
5 changed files with 43 additions and 18 deletions
+3 -2
View File
@@ -53,8 +53,9 @@ class Album:
TrackStore.append_track_artists(self.albumhash, featured, self.title)
if get_flag(ParserFlags.CLEAN_ALBUM_TITLE):
# if FromFlags.CLEAN_ALBUM_TITLE:
self.title, self.versions = get_base_title_and_versions(self.title)
get_versions = not get_flag(ParserFlags.MERGE_ALBUM_VERSIONS)
self.title, self.versions = get_base_title_and_versions(self.title, get_versions=get_versions)
self.base_title = self.title
if "super_deluxe" in self.versions:
+17 -1
View File
@@ -33,6 +33,7 @@ class Track:
image: str = ""
artist_hashes: str = ""
is_favorite: bool = False
og_title: str = ""
og_album: str = ""
@@ -54,7 +55,7 @@ class Track:
# if track is a single
if self.og_title == self.album:
self.album = new_title
self.rename_album(new_title)
if get_flag(ParserFlags.REMOVE_REMASTER_FROM_TRACK):
new_title = clean_title(new_title)
@@ -64,6 +65,9 @@ class Track:
if get_flag(ParserFlags.CLEAN_ALBUM_TITLE):
self.album, _ = get_base_title_and_versions(self.album, get_versions=False)
if get_flag(ParserFlags.MERGE_ALBUM_VERSIONS):
self.recreate_albumhash()
self.artist_hashes = "-".join(create_hash(a, decode=True) for a in artists)
self.artist = [ArtistMinimal(a) for a in artists]
@@ -91,9 +95,21 @@ class Track:
self.trackhash = create_hash(", ".join([a.name for a in self.artist]), self.og_album, self.title)
def recreate_artists_hash(self):
"""
Recreates a track's artist hashes if the artist list was altered
"""
self.artist_hashes = "-".join(a.artisthash for a in self.artist)
def recreate_albumhash(self):
"""
Recreates an albumhash of a track to merge all versions of an album.
"""
self.albumhash = create_hash(self.album, self.albumartist)
def rename_album(self, new_album: str):
"""
Renames an album
"""
self.album = new_album
def add_artists(self, artists: list[str], new_album_title: str):