Skip to content

Commit d08ad62

Browse files
authored
Merge pull request #118 from bloedboemmel/remove_by_indices
Added function for multiple deletions at once
2 parents 57931a7 + 77f1dfe commit d08ad62

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

tidalapi/playlist.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,12 @@ def remove_by_index(self, index):
205205
headers = {'If-None-Match': self._etag}
206206
self.requests.request('DELETE', (self._base_url + '/items/%i') % (self.id, index), headers=headers)
207207

208+
def remove_by_indices(self, indices):
209+
headers = {'If-None-Match': self._etag}
210+
track_index_string = ",".join([str(x) for x in indices])
211+
self.requests.request('DELETE', (self._base_url + '/tracks/%s') % (self.id, track_index_string),
212+
headers=headers)
213+
208214
def _calculate_id(self, media_id):
209215
i = 0
210216
while i < self.num_tracks:

0 commit comments

Comments
 (0)