diff options
Diffstat (limited to 'pandora/client.py')
-rw-r--r-- | pandora/client.py | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/pandora/client.py b/pandora/client.py index 01b7654..df09144 100644 --- a/pandora/client.py +++ b/pandora/client.py | |||
@@ -127,15 +127,28 @@ class APIClient(BaseAPIClient): | |||
127 | def get_station_list_checksum(self): # pragma: no cover | 127 | def get_station_list_checksum(self): # pragma: no cover |
128 | return self("user.getStationListChecksum")["checksum"] | 128 | return self("user.getStationListChecksum")["checksum"] |
129 | 129 | ||
130 | def get_playlist(self, station_token): | 130 | def get_playlist(self, station_token, additional_urls=None): |
131 | from .models.pandora import Playlist | 131 | from .models.pandora import Playlist |
132 | 132 | ||
133 | playlist = Playlist.from_json(self, | 133 | if additional_urls is None: |
134 | self("station.getPlaylist", | 134 | additional_urls = [] |
135 | stationToken=station_token, | 135 | |
136 | includeTrackLength=True, | 136 | if isinstance(additional_urls, str): |
137 | xplatformAdCapable=True, | 137 | raise TypeError('Additional urls should be a list') |
138 | audioAdPodCapable=True)) | 138 | |
139 | urls = [getattr(url, "value", url) for url in additional_urls] | ||
140 | |||
141 | resp = self("station.getPlaylist", | ||
142 | stationToken=station_token, | ||
143 | includeTrackLength=True, | ||
144 | xplatformAdCapable=True, | ||
145 | audioAdPodCapable=True, | ||
146 | additionalAudioUrl=','.join(urls)) | ||
147 | |||
148 | for item in resp['items']: | ||
149 | item['_paramAdditionalUrls'] = additional_urls | ||
150 | |||
151 | playlist = Playlist.from_json(self, resp) | ||
139 | 152 | ||
140 | for i, track in enumerate(playlist): | 153 | for i, track in enumerate(playlist): |
141 | if track.is_ad: | 154 | if track.is_ad: |