Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spotify playlists take time time to fetch, rendering !clear kinda useless. #2375

Closed
3 tasks done
BgueC6595 opened this issue Dec 18, 2023 · 2 comments
Closed
3 tasks done
Labels
needs triage t/bug This issue is quite clearly a bug
Projects

Comments

@BgueC6595
Copy link

BgueC6595 commented Dec 18, 2023

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?

  1. 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)

  2. (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)

  3. Use !clear in an attempt to clear the queue

  4. 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.
@BgueC6595 BgueC6595 added needs triage t/bug This issue is quite clearly a bug labels Dec 18, 2023
@BabyBoySnow
Copy link
Collaborator

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.

@itsTheFae
Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs triage t/bug This issue is quite clearly a bug
Projects
Bugs
  
Awaiting triage
Development

No branches or pull requests

3 participants