Skip to content

Commit

Permalink
Merge pull request #118 from bloedboemmel/remove_by_indices
Browse files Browse the repository at this point in the history
Added function for multiple deletions at once
  • Loading branch information
tehkillerbee authored May 22, 2023
2 parents 57931a7 + 77f1dfe commit d08ad62
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions tidalapi/playlist.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,12 @@ def remove_by_index(self, index):
headers = {'If-None-Match': self._etag}
self.requests.request('DELETE', (self._base_url + '/items/%i') % (self.id, index), headers=headers)

def remove_by_indices(self, indices):
headers = {'If-None-Match': self._etag}
track_index_string = ",".join([str(x) for x in indices])
self.requests.request('DELETE', (self._base_url + '/tracks/%s') % (self.id, track_index_string),
headers=headers)

def _calculate_id(self, media_id):
i = 0
while i < self.num_tracks:
Expand Down

0 comments on commit d08ad62

Please sign in to comment.