mirror of
https://github.com/spotipy-dev/spotipy.git
synced 2026-04-27 08:35:49 +03:00
[GH-ISSUE #487] 'insert_before' for 'user_playlist_replace_tracks' function? Or reorder against track ids for 'user_playlist_reorder_tracks' function? #286
Labels
No labels
api-bug
bug
dependencies
documentation
duplicate
enhancement
external-ide
headless-mode
implicit-grant-flow
invalid
missing-endpoint
pr-welcome
private-api
pull-request
question
spotipy3
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/spotipy#286
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @sjames272727 on GitHub (Apr 29, 2020).
Original GitHub issue: https://github.com/spotipy-dev/spotipy/issues/487
I'm trying to reorder a playlist with above 100 tracks using either the 'user_playlist_reorder_tracks' function or the 'user_playlist_reorder_tracks' function. I can't use the 'user_playlist_add_tracks' function because I need to maintain the 'added_at' date.
So what I'm trying to do is segment the playlist into 100s so that I don't go above the 100 track limit.
Is there a way to use the 'user_playlist_reorder_tracks' function and reorder it against a list of track ids. Or use the 'user_playlist_reorder_tracks' and choose the the range of tracks to replace?
Sorry if this is a stupid question, I'm new to the Spotipy library and Python in general.
@stephanebruckert commented on GitHub (Apr 30, 2020):
There is probably a way but you will have to write the code for it. What
user_playlist_reorder_tracksdoes is switch one or multiple tracks that follow each other to a new index in the same playlist. See the doc https://spotipy.readthedocs.io/en/2.12.0/#spotipy.client.Spotify.user_playlist_reorder_tracksHere is an example that reverts a playlist https://gist.github.com/stephanebruckert/d0cc70508e72273995d297f6af6fad13
@sjames272727 commented on GitHub (May 1, 2020):
Yes I actually did find a way myself, but it was extremely slow, where it reordered about 1 track every 1.5 seconds. It was actually pretty similar to the example you gave.
Thank you, I'll probably just use the example you gave and limit the number of tracks to be reordered to 300 tracks in order to prevent crashing.