feat: improved initialization of data objects

This commit is contained in:
2024-05-08 09:44:18 +02:00
parent e3e547c232
commit a5f8057b82
3 changed files with 86 additions and 39 deletions

View File

@@ -254,7 +254,7 @@ class Page:
}
if obj_type in fetch_map:
music_object = fetch_map[obj_type](source, stop_at_level)
music_object = fetch_map[obj_type](source, stop_at_level=stop_at_level)
else:
self.LOGGER.warning(f"Can't fetch details of type: {obj_type}")
return None

View File

@@ -785,7 +785,7 @@ class Musify(Page):
return album
def _fetch_initial_artist(self, url: MusifyUrl, source: Source) -> Artist:
def _fetch_initial_artist(self, url: MusifyUrl, source: Source, **kwargs) -> Artist:
"""
https://musify.club/artist/ghost-bath-280348?_pjax=#bodyContent
"""
@@ -907,7 +907,7 @@ class Musify(Page):
notes=notes
)
def _parse_album_card(self, album_card: BeautifulSoup, source: Source, artist_name: str = None, **kwargs) -> Album:
def _parse_album_card(self, album_card: BeautifulSoup, artist_name: str = None, **kwargs) -> Album:
"""
<div class="card release-thumbnail" data-type="2">
<a href="/release/ghost-bath-self-loather-2021-1554266">
@@ -932,7 +932,7 @@ class Musify(Page):
"""
album_kwargs: Dict[str, Any] = {
"source_list": [source],
"source_list": [],
}
name: str = None
@@ -1069,7 +1069,7 @@ class Musify(Page):
soup: BeautifulSoup = self.get_soup_from_response(r)
for card_soup in soup.find_all("div", {"class": "card"}):
album = self._parse_album_card(card_soup, source, artist_name, **kwargs)
album = self._parse_album_card(card_soup, artist_name, **kwargs)
if album.album_type in _album_type_blacklist:
continue