diff --git a/music_kraken/objects/collection.py b/music_kraken/objects/collection.py index 7090aff..d008fb1 100644 --- a/music_kraken/objects/collection.py +++ b/music_kraken/objects/collection.py @@ -82,9 +82,9 @@ class Collection(Generic[T]): def _find_object(self, __object: T) -> Optional[T]: for c in self.push_to: - found = c._find_object(__object) + found, found_in = c._find_object(__object) if found is not None: - return found, c + return found, found_in self._remap() @@ -92,6 +92,8 @@ class Collection(Generic[T]): if value in self._indexed_values[name]: return self._indexed_values[name][value], self + return None, self + def append(self, __object: Optional[T], **kwargs): """ If an object, that represents the same entity exists in a relevant collection, diff --git a/music_kraken/pages/youtube_music/_list_render.py b/music_kraken/pages/youtube_music/_list_render.py index cd7f878..a820014 100644 --- a/music_kraken/pages/youtube_music/_list_render.py +++ b/music_kraken/pages/youtube_music/_list_render.py @@ -56,14 +56,7 @@ def music_responsive_list_item_renderer(renderer: dict) -> List[DatabaseObject]: for song in song_list: song.album_collection.extend(album_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) + song.feature_artist_collection.extend(artist_list) if len(song_list) > 0: return song_list