fixed really disgusting bug

This commit is contained in:
Hellow2
2023-04-03 16:23:30 +02:00
parent a20f7ae59e
commit f58685af58
4 changed files with 25 additions and 14 deletions

View File

@@ -220,9 +220,11 @@ class Page:
Album: Collection(element_type=Album),
Song: Collection(element_type=Song)
}
cls._clean_music_object(new_music_object, collections)
print(collections[Album])
music_object.merge(new_music_object)
music_object.compile(merge_into=True)
@@ -280,13 +282,11 @@ class Page:
return
for i, element in enumerate(collection):
r = collection_dict[collection.element_type].append(element)
if not r.was_in_collection:
cls._clean_music_object(r.current_element, collection_dict)
continue
r = collection_dict[collection.element_type].append(element, merge_into_existing=True)
collection[i] = r.current_element
cls._clean_music_object(r.current_element, collection_dict)
if not r.was_the_same:
cls._clean_music_object(r.current_element, collection_dict)
@classmethod
def _clean_label(cls, label: Label, collections: Dict[Union[Type[Song], Type[Album], Type[Artist], Type[Label]], Collection]):

View File

@@ -565,10 +565,11 @@ class Musify(Page):
for card_soup in soup.find_all("div", {"class": "card"}):
new_album: Album = cls.parse_album_card(card_soup, artist_name)
album_source: Source
if stop_at_level > 1:
for album_source in new_album.source_collection.get_sources_from_page(cls.SOURCE_TYPE):
new_album.merge(cls._fetch_album_from_source(album_source, stop_at_level=stop_at_level-1))
discography.append(new_album)
return discography
@@ -726,7 +727,7 @@ class Musify(Page):
discography: List[Album] = cls.get_discography(url, artist.name)
artist.main_album_collection.extend(discography)
return artist
@classmethod