Announcements

Help Wizard

Step 1

NEXT STEP

API returns queue that loops around even when repeat is disabled

API returns queue that loops around even when repeat is disabled

When playing an album, requesting the queue through the API returns more songs than will actually be played.  For example, if you play an album with tracks One, Two, Three, Four, the API will return "Two, Three, Four, One, Two, Three, Four, ..." (not infinitely; it seems to return about 15-20 results).

 

Here's the code I used to test this:

import spotipy
from spotipy.oauth2 import SpotifyOAuth

sp = spotipy.Spotify(auth_manager=SpotifyOAuth())
queue = sp.queue()['queue']
for i, track in enumerate(queue):
print(i, track['name'])

 

(I doubt this is a spotipy bug; I originally encountered this using spotify-player, which uses rspotify.)

 

Playback works fine, the tracks aren't actually looped, they only show up this way in the queue.

 

Is there any recommended workaround for this, i.e. some way to know how many tracks will actually be played?  Or could this perhaps be corrected?

Reply
0 Replies

Suggested posts

Let's introduce ourselves!

Hey there you,   Yeah, you! 😁   Welcome - we're glad you joined the Spotify Community!   While you here, let's have a fun game and get…

ModeratorStaff / Moderator/ 4 years ago  in Social & Random