From 13d0df8f97a6d4bac868c9bdfdbb2c5d9a8559d5 Mon Sep 17 00:00:00 2001 From: MiroslavRosenov <57327793+MiroslavRosenov@users.noreply.github.com> Date: Wed, 23 Feb 2022 11:06:15 +0200 Subject: [PATCH] Update artist.py --- pomice/spotify/artist.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/pomice/spotify/artist.py b/pomice/spotify/artist.py index 8b13789..ae718c7 100644 --- a/pomice/spotify/artist.py +++ b/pomice/spotify/artist.py @@ -1 +1,18 @@ +class Artist: + """The base class for a Spotify artist""" + def __init__(self, data: dict, tracks: dict) -> None: + self.name = f"Top tracks for {data['name']}" + self.genres = ", ".join(genre for genre in data["genres"]) + self.followers = data["followers"]["total"] + self.image = data["images"][0]["url"] + self.tracks = tracks + self.total_tracks = len(tracks) + self.id = data["id"] + self.uri = data["external_urls"]["spotify"] + + def __repr__(self) -> str: + return ( + f"" + )