feat: musify completed
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
This commit is contained in:
parent
1ef4b27f28
commit
05ee09e25f
@ -754,11 +754,18 @@ class Musify(Page):
|
||||
except ValueError:
|
||||
self.LOGGER.debug(f"Raw datetime doesn't match time format %Y-%m-%d: {raw_datetime}")
|
||||
|
||||
# album artwork
|
||||
album_artwork: Artwork = Artwork()
|
||||
album_artwork_list: List[BeautifulSoup] = soup.find_all("img", {"class":"artist-img"})
|
||||
for album_artwork in album_artwork_list:
|
||||
album_artwork.append(url=album_artwork.get("data-src", album_artwork.get("src")))
|
||||
|
||||
return Album(
|
||||
title=name,
|
||||
source_list=source_list,
|
||||
artist_list=artist_list,
|
||||
date=date
|
||||
date=date,
|
||||
artwork=album_artwork
|
||||
)
|
||||
|
||||
def fetch_album(self, source: Source, stop_at_level: int = 1) -> Album:
|
||||
@ -795,6 +802,8 @@ class Musify(Page):
|
||||
new_song = self._parse_song_card(card_soup)
|
||||
album.song_collection.append(new_song)
|
||||
|
||||
|
||||
|
||||
album.update_tracksort()
|
||||
|
||||
return album
|
||||
@ -914,12 +923,18 @@ class Musify(Page):
|
||||
if note_soup is not None:
|
||||
notes.html = note_soup.decode_contents()
|
||||
|
||||
# get artist profile artwork
|
||||
main_artist_artwork: Artwork = Artwork()
|
||||
artist_image_element_list: List[BeautifulSoup] = soup.find_all("img", {"class":"artist-img"})
|
||||
for artist_image_element in artist_image_element_list:
|
||||
main_artist_artwork.append(url=artist_image_element.get("data-src", artist_image_element.get("src")))
|
||||
|
||||
return Artist(
|
||||
name=name,
|
||||
country=country,
|
||||
source_list=source_list,
|
||||
notes=notes,
|
||||
artwork=self._fetch_artist_artwork(soup, **kwargs)
|
||||
artwork=main_artist_artwork
|
||||
)
|
||||
|
||||
def _parse_album_card(self, album_card: BeautifulSoup, artist_name: str = None, **kwargs) -> Album:
|
||||
@ -1057,33 +1072,29 @@ class Musify(Page):
|
||||
|
||||
artist.album_collection.append(album)
|
||||
|
||||
def _fetch_artist_artwork(self, soup: BeautifulSoup, **kwargs):
|
||||
def _fetch_artist_artwork(self, source: str, artist: Artist, **kwargs):
|
||||
# artist artwork
|
||||
artist_artwork: List[Artwork] = Artwork()
|
||||
artist_a_element_list: List[BeautifulSoup] = soup.find_all("a")
|
||||
for artist_a_element in artist_a_element_list:
|
||||
if artist_a_element.find_all("img", {"class": "artist-img"}).count() > 0:
|
||||
artwork_gallery = self.connection.get(artist_a_element("data-src", artist_a_element.get("href")))
|
||||
artwork_gallery = self.get_soup_from_response(self.connection.get(source.strip().strip("/") + "/photos"))
|
||||
if artwork_gallery is not None:
|
||||
gallery_image_element_list: List[BeautifulSoup] = artwork_gallery.find_all("img", {"class": "artist-img"})
|
||||
gallery_body_content: BeautifulSoup = artwork_gallery.find(id="bodyContent")
|
||||
gallery_image_element_list: List[BeautifulSoup] = gallery_body_content.find_all("img")
|
||||
for gallery_image_element in gallery_image_element_list:
|
||||
artist_artwork.push(Artwork(url=gallery_image_element.get("data-src", gallery_image_element.get("src"))))
|
||||
artist.artwork.append(url=gallery_image_element.get("data-src", gallery_image_element.get("src")), width=247, heigth=247)
|
||||
|
||||
return artist_artwork
|
||||
|
||||
def fetch_artist(self, source: Source, **kwargs) -> Artist:
|
||||
"""
|
||||
TODO
|
||||
[x] discography
|
||||
[x] attributes
|
||||
[] picture gallery
|
||||
[x] picture gallery
|
||||
"""
|
||||
|
||||
url = parse_url(source.url)
|
||||
|
||||
artist = self._fetch_initial_artist(url, source=source, **kwargs)
|
||||
self._fetch_artist_discography(artist, url, artist.name, **kwargs)
|
||||
self._fetch_artist_artwork(artist, **kwargs)
|
||||
self._fetch_artist_artwork(url.url, artist, **kwargs)
|
||||
return artist
|
||||
|
||||
def fetch_label(self, source: Source, stop_at_level: int = 1) -> Label:
|
||||
|
Loading…
Reference in New Issue
Block a user