diff --git a/pomice/node.py b/pomice/node.py index ee066c8..c9cdb8a 100644 --- a/pomice/node.py +++ b/pomice/node.py @@ -286,7 +286,9 @@ class Node: playlist_info={"name": results.name, "selectedTrack": tracks[0]}, tracks=tracks, ctx=ctx, - spotify=True + spotify=True, + thumbnail=results.images[0].url, + uri=results.url, ) except SpotifyException: @@ -324,7 +326,9 @@ class Node: playlist_info={"name": results.name, "selectedTrack": tracks[0]}, tracks=tracks, ctx=ctx, - spotify=True + spotify=True, + thumbnail=results.images[0].url, + uri=results.url, ) except SpotifyException: diff --git a/pomice/objects.py b/pomice/objects.py index 49f1c87..6707df7 100644 --- a/pomice/objects.py +++ b/pomice/objects.py @@ -57,7 +57,9 @@ class Playlist: playlist_info: dict, tracks: list, ctx: Optional[commands.Context] = None, - spotify: bool = False + spotify: bool = False, + thumbnail: Optional[str] = None, + uri: Optional[str] = None, ): self.playlist_info = playlist_info self.tracks_raw = tracks @@ -66,6 +68,9 @@ class Playlist: self.name = playlist_info.get("name") self.selected_track = playlist_info.get("selectedTrack") + self.thumbnail = thumbnail + self.uri = uri + if self.spotify: self.tracks = tracks else: @@ -81,3 +86,13 @@ class Playlist: def __repr__(self): return f"" + + @property + def uri(self) -> Optional[str]: + """Spotify album/playlist URI, or None if not a Spotify object.""" + return self.uri + + @property + def thumbnail(self) -> Optional[str]: + """Spotify album/playlist thumbnail, or None if not a Spotify object.""" + return self.thumbnail