diff options
author | jcass <john.cass77@gmail.com> | 2015-12-21 13:31:07 +0200 |
---|---|---|
committer | jcass <john.cass77@gmail.com> | 2015-12-21 13:31:07 +0200 |
commit | e5b7b7d587baaff35388fab6b85664dc99f98803 (patch) | |
tree | 09c75445f0ee802645e8b6d11af6a6f4848b8f6a /pandora | |
parent | 0e4e9f8b3e211a5e33a93ee8a939aab62ea8f736 (diff) | |
download | pydora-e5b7b7d587baaff35388fab6b85664dc99f98803.tar.bz2 pydora-e5b7b7d587baaff35388fab6b85664dc99f98803.tar.xz pydora-e5b7b7d587baaff35388fab6b85664dc99f98803.zip |
Process ad tokens in-place instead of making a copy of the list.
Diffstat (limited to 'pandora')
-rw-r--r-- | pandora/client.py | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/pandora/client.py b/pandora/client.py index 5703561..8f093b3 100644 --- a/pandora/client.py +++ b/pandora/client.py | |||
@@ -127,18 +127,17 @@ class APIClient(BaseAPIClient): | |||
127 | def get_playlist(self, station_token): | 127 | def get_playlist(self, station_token): |
128 | from .models.pandora import Playlist | 128 | from .models.pandora import Playlist |
129 | 129 | ||
130 | raw_playlist = Playlist.from_json(self, | 130 | playlist = Playlist.from_json(self, |
131 | self("station.getPlaylist", | 131 | self("station.getPlaylist", |
132 | stationToken=station_token, | 132 | stationToken=station_token, |
133 | includeTrackLength=True, | 133 | includeTrackLength=True, |
134 | xplatformAdCapable=True, | 134 | xplatformAdCapable=True, |
135 | audioAdPodCapable=True)) | 135 | audioAdPodCapable=True)) |
136 | 136 | ||
137 | playlist = [] | 137 | for i, track in enumerate(playlist): |
138 | for track in raw_playlist: | ||
139 | if track.is_ad: | 138 | if track.is_ad: |
140 | track = self.get_ad_item(station_token, track.ad_token) | 139 | track = self.get_ad_item(station_token, track.ad_token) |
141 | playlist.append(track) | 140 | playlist[i] = track |
142 | 141 | ||
143 | return playlist | 142 | return playlist |
144 | 143 | ||