fix/reindex_before_collection #21

Merged
Hazel merged 32 commits from fix/reindex_before_collection into experimental 2024-05-06 17:36:28 +00:00
2 changed files with 16 additions and 4 deletions
Showing only changes of commit a3ef671f00 - Show all commits

View File

@ -143,7 +143,10 @@ class Collection(Generic[T]):
return
existing_object.merge(__object, **kwargs)
self._map_element(existing_object)
self._map_element(existing_object)
def contains(self, __object: T) -> bool:
return self._find_object(__object) is not None
def extend(self, __iterable: Optional[Generator[T, None, None]], **kwargs):
if __iterable is None:

View File

@ -56,15 +56,24 @@ def music_responsive_list_item_renderer(renderer: dict) -> List[DatabaseObject]:
for song in song_list:
song.album_collection.extend(album_list)
song.main_artist_collection.extend(artist_list)
for artist in artist_list:
existing_artist = song.main_artist_collection._find_object(artist)
if existing_artist is None:
song.feature_artist_collection.append(artist)
else:
existing_artist.merge(artist)
if len(song_list) > 0:
return song_list
for album in album_list:
album.artist_collection.extend(artist_list)
if len(song_list) > 0:
return song_list
if len(album_list) > 0:
return album_list
if len(artist_list) > 0:
return artist_list