|
11 | 11 | from librespot.cache import CacheManager |
12 | 12 | from librespot.crypto import CipherPair, DiffieHellman, Packet |
13 | 13 | from librespot.mercury import MercuryClient, MercuryRequests, RawMercuryRequest |
14 | | -from librespot.metadata import AlbumId, ArtistId, EpisodeId, ShowId, TrackId |
15 | | -from librespot.proto import Authentication_pb2 as Authentication, ClientToken_pb2 as ClientToken, Connect_pb2 as Connect, Connectivity_pb2 as Connectivity, Keyexchange_pb2 as Keyexchange, Metadata_pb2 as Metadata |
| 14 | +from librespot.metadata import AlbumId, ArtistId, EpisodeId, ShowId, TrackId, PlaylistId |
| 15 | +from librespot.proto import Authentication_pb2 as Authentication, ClientToken_pb2 as ClientToken, Connect_pb2 as Connect, Connectivity_pb2 as Connectivity, Keyexchange_pb2 as Keyexchange, Metadata_pb2 as Metadata, Playlist4External_pb2 as Playlist4External |
16 | 16 | from librespot.proto.ExplicitContentPubsub_pb2 import UserAttributesUpdate |
17 | 17 | from librespot.structure import Closeable, MessageListener, RequestListener, SubListener |
18 | 18 | import base64 |
@@ -154,6 +154,18 @@ def get_metadata_4_show(self, show: ShowId) -> Metadata.Show: |
154 | 154 | proto.ParseFromString(body) |
155 | 155 | return proto |
156 | 156 |
|
| 157 | + def get_playlist(self, _id: PlaylistId) -> Playlist4External.SelectedListContent: |
| 158 | + response = self.send("GET", |
| 159 | + "/playlist/v2/playlist/{}".format(_id.id()), None, |
| 160 | + None) |
| 161 | + ApiClient.StatusCodeException.check_status(response) |
| 162 | + body = response.content |
| 163 | + if body is None: |
| 164 | + raise IOError() |
| 165 | + proto = Playlist4External.SelectedListContent() |
| 166 | + proto.ParseFromString(body) |
| 167 | + return proto |
| 168 | + |
157 | 169 | def set_client_token(self, client_token): |
158 | 170 | self.__client_token_str = client_token |
159 | 171 |
|
|
0 commit comments