From cc6d02d3739974f96fe9b35afaa5750531957b9a Mon Sep 17 00:00:00 2001 From: Marcel van der Veldt Date: Thu, 24 Oct 2024 00:26:28 +0200 Subject: [PATCH] Fix playlist index for removals --- music_assistant/server/providers/builtin/__init__.py | 2 +- music_assistant/server/providers/deezer/__init__.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/music_assistant/server/providers/builtin/__init__.py b/music_assistant/server/providers/builtin/__init__.py index ef1f45b8b..4b341ceb7 100644 --- a/music_assistant/server/providers/builtin/__init__.py +++ b/music_assistant/server/providers/builtin/__init__.py @@ -412,7 +412,7 @@ async def remove_playlist_tracks( playlist_items = await self._read_playlist_file_items(prov_playlist_id) # remove items by index for i in sorted(positions_to_remove, reverse=True): - del playlist_items[i] + del playlist_items[i - 1] # store playlist file await self._write_playlist_file_items(prov_playlist_id, playlist_items) # mark last_updated on playlist object diff --git a/music_assistant/server/providers/deezer/__init__.py b/music_assistant/server/providers/deezer/__init__.py index 6be1f0ce3..93c3614c8 100644 --- a/music_assistant/server/providers/deezer/__init__.py +++ b/music_assistant/server/providers/deezer/__init__.py @@ -409,7 +409,7 @@ async def remove_playlist_tracks( ) -> None: """Remove track(s) from playlist.""" playlist_track_ids = [] - for track in await self.get_playlist_tracks(prov_playlist_id, 0, 10000): + for track in await self.get_playlist_tracks(prov_playlist_id, 0): if track.position in positions_to_remove: playlist_track_ids.append(int(track.item_id)) if len(playlist_track_ids) == len(positions_to_remove):