feat: theoretically fetching feature songs
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

This commit is contained in:
Hazel 2024-05-21 16:34:04 +02:00
parent 46b64b8f8d
commit f5d953d9ce

View File

@ -182,7 +182,7 @@ class Genius(Page):
return results return results
def fetch_artist(self, source: Source, stop_at_level: int = 1) -> Artist: def fetch_artist(self, source: Source, stop_at_level: int = 1) -> Artist:
artist = Artist() artist: Artist = Artist()
# https://genius.com/api/artists/24527/albums?page=1 # https://genius.com/api/artists/24527/albums?page=1
r = self.connection.get(source.url, name=source.url) r = self.connection.get(source.url, name=source.url)
@ -200,7 +200,26 @@ class Genius(Page):
artist = self.parse_api_object(data.get("artist", {})) artist = self.parse_api_object(data.get("artist", {}))
for e in data.get("artist_albums", []): for e in data.get("artist_albums", []):
artist.album_collection.append(self.parse_api_object(e)) r = self.parse_api_object(e)
if not isinstance(r, Album):
continue
artist.album_collection.append(r)
for e in data.get("artist_songs", []):
r = self.parse_api_object(e)
if not isinstance(r, Song):
continue
"""
TODO
fetch the album for these songs, because the api doesn't
return them
"""
artist.album_collection.extend(r.album_collection)
artist.source_collection.append(source)
return artist return artist