feat: tried improving fetching
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

This commit is contained in:
Hellow 2024-04-30 02:09:52 +02:00
parent e9b1a12aa1
commit a3ef671f00
2 changed files with 16 additions and 4 deletions

View File

@ -145,6 +145,9 @@ class Collection(Generic[T]):
existing_object.merge(__object, **kwargs)
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:
return

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