From d87a6644f6909420ac3984e183823e22bd198b74 Mon Sep 17 00:00:00 2001 From: Crussader <75786691+Crussader@users.noreply.github.com> Date: Thu, 28 Oct 2021 18:26:03 +0400 Subject: [PATCH] spotify code cleanup --- pomice/spotify/track.py | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/pomice/spotify/track.py b/pomice/spotify/track.py index 96af859..c5aabe2 100644 --- a/pomice/spotify/track.py +++ b/pomice/spotify/track.py @@ -1,18 +1,22 @@ + class Track: """The base class for a Spotify Track""" def __init__(self, data: dict) -> None: - self.name = data['name'] - self.artists = ", ".join(artist["name"] for artist in data['artists']) - self.length = data['duration_ms'] - self.id = data['id'] + self.name = data["name"] + self.artists = ", ".join(artist["name"] for artist in data["artists"]) + self.length = data["duration_ms"] + self.id = data["id"] if data.get("album") and data["album"]["images"]: - self.image = data['album']['images'][0]['url'] + self.image = data["album"]["images"][0]["url"] else: self.image = None - self.uri = data['external_urls']['spotify'] + self.uri = data["external_urls"]["spotify"] def __repr__(self) -> str: - return f"" + return ( + f"" + )