From e91f605a7aaed88a2784a7dd7fe81b953cd70e65 Mon Sep 17 00:00:00 2001 From: Crussader <75786691+Crussader@users.noreply.github.com> Date: Sun, 27 Mar 2022 20:58:30 +0400 Subject: [PATCH] Create artist.py --- pomice/spotify/artist.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 pomice/spotify/artist.py diff --git a/pomice/spotify/artist.py b/pomice/spotify/artist.py new file mode 100644 index 0000000..baa5a5f --- /dev/null +++ b/pomice/spotify/artist.py @@ -0,0 +1,18 @@ +class Artist: + """The base class for a Spotify artist""" + + def __init__(self, data: dict, tracks: list) -> 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"" + )