draft: the problem is in _list_renderer.py
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
This commit is contained in:
@@ -89,52 +89,6 @@ class NamingDict(dict):
|
||||
return self.default_value_for_name(attribute_name)
|
||||
|
||||
|
||||
def _clean_music_object(music_object: INDEPENDENT_DB_OBJECTS, collections: Dict[INDEPENDENT_DB_TYPES, Collection]):
|
||||
if type(music_object) == Label:
|
||||
return _clean_label(label=music_object, collections=collections)
|
||||
if type(music_object) == Artist:
|
||||
return _clean_artist(artist=music_object, collections=collections)
|
||||
if type(music_object) == Album:
|
||||
return _clean_album(album=music_object, collections=collections)
|
||||
if type(music_object) == Song:
|
||||
return _clean_song(song=music_object, collections=collections)
|
||||
|
||||
|
||||
def _clean_collection(collection: Collection, collection_dict: Dict[INDEPENDENT_DB_TYPES, Collection]):
|
||||
if collection.element_type not in collection_dict:
|
||||
return
|
||||
|
||||
for i, element in enumerate(collection):
|
||||
r = collection_dict[collection.element_type].append(element, merge_into_existing=True)
|
||||
collection[i] = r.current_element
|
||||
|
||||
if not r.was_the_same:
|
||||
_clean_music_object(r.current_element, collection_dict)
|
||||
|
||||
|
||||
def _clean_label(label: Label, collections: Dict[INDEPENDENT_DB_TYPES, Collection]):
|
||||
_clean_collection(label.current_artist_collection, collections)
|
||||
_clean_collection(label.album_collection, collections)
|
||||
|
||||
|
||||
def _clean_artist(artist: Artist, collections: Dict[INDEPENDENT_DB_TYPES, Collection]):
|
||||
_clean_collection(artist.main_album_collection, collections)
|
||||
_clean_collection(artist.feature_song_collection, collections)
|
||||
_clean_collection(artist.label_collection, collections)
|
||||
|
||||
|
||||
def _clean_album(album: Album, collections: Dict[INDEPENDENT_DB_TYPES, Collection]):
|
||||
_clean_collection(album.label_collection, collections)
|
||||
_clean_collection(album.song_collection, collections)
|
||||
_clean_collection(album.artist_collection, collections)
|
||||
|
||||
|
||||
def _clean_song(song: Song, collections: Dict[INDEPENDENT_DB_TYPES, Collection]):
|
||||
_clean_collection(song.album_collection, collections)
|
||||
_clean_collection(song.feature_artist_collection, collections)
|
||||
_clean_collection(song.main_artist_collection, collections)
|
||||
|
||||
|
||||
class Page:
|
||||
"""
|
||||
This is an abstract class, laying out the
|
||||
|
||||
Reference in New Issue
Block a user