Spotify playlists take time time to fetch, rendering !clear kinda useless.
Closed this issue · 2 comments
What went wrong?
Maybe this should qualify as a feature request, I'm not sure. Tested on the dev branch (latest commit).
Spotify playlists take a while to be cached by the bot; it takes a couple seconds for each individual song to be put into the queue.
The issue arises when someone with permissions wants to clear the queue of this playlist. It effectively becomes impossible without restarting the bot or without waiting several minutes for the songs to be cached. This is because e.g. if 5 songs have been put into the queue, when someone uses !clear
the bot will clear the queue BUT it will also keep adding new songs to the queue (songs that were unfetched at the time). Only way to stop the bot is to restart it.
I imagine the ideal solution would be to make !clear
cancel any pending attempts to fetch songs from playlists.
How do we reproduce this?
-
On a bot instance with Spotify credentials enabled, use
!play [spotify playlist URL]
in which the playlist has multiple songs (more than 5 is fine) -
(Optional) Once the first song starts playing, observe with
!queue
that only one or two songs are queued at this moment. Over time more songs will be added; next steps must be taken before the whole playlist is queued (which takes a while anyway) -
Use
!clear
in an attempt to clear the queue -
Observe that while the queue at the time was cleared, this doesn't stop the bot from fetching more songs from the playlist that weren't queued at the time
Which version of the bot are you using?
I am using the "dev" branch
Which operating system are you using?
Ubuntu 18.04 or higher
Just checking...
- I have confirmed that my issue has not already been reported.
- I am using Python 3.8 or higher.
- I have updated my Python dependencies.
The delay is because we can't directly grab anything from Spotify, we have to grab the meta data (author, and track name) then get it from YouTube.
The reason it only shows 1-2 songs at first is because the rest of the playlist is being downloaded amd added. (You can measure roughly how fast by using the shuffle play, it's only on the dev branch as I haven't found a way to download the playlist entirely, then shuffle, then play. Currently it'll play a few songs in the correct order before the playlist is downloaded and then shuffle. Not exactly ideal.)
I do agree that this is something to be looked into but will call it low priority as I would argue that not many people tend to queue a playlist then immediately try to clear it. I think this is more similar to the request for an undo command. Which I also agree might be a good command but haven't had the time to look into it yet.
The patch in PR #2378 is not the most comprehensive, but it should avoid this behavior at least for spotify playlists and albums. I welcome feedback on it, if you're willing to test it out @BgueC6595