Closed SimonStjernholm closed 4 months ago
Fixes I have thought of myself, however this seems like some hacky ways and could properly be implemented in a better way. I could create a PR if this somehow is the solution you guys would like to go with.
In play.rs
, all QueryType::PlaylistLink
handlers could be updated to check if an existing channel connection is established on the urls.iter()
:
for url in urls.iter() {
let handler = call.lock().await;
let cancel_playlist_addition = handler.current_connection().is_none();
drop(handler);
if cancel_playlist_addition {
// End command execution when no more songs should be added.
return Ok(());
}
...
}
in youtube.rs
, the function ytdl_playlist()
we could the check the url for the mix list parameter list=RDxxxxxxxxxx
in that case, we could add the arg "--no-playlist"
to the yt-dlp command to discard the playlist and only query for the song specificed. As stated in notes above mix-playlists can't be played itself, without having watch?v=xxxx
defined aswell. Therefore there should always be an initial video.
Note: The above solution completely disallows the option to play youtube playlist mixes. However, if played anyways, unlimited numbers of songs would be added to the queue, and I guess the bot would crash at some point. Since you currently can't cancel playlist queue addition, I guess some kind of avoidance/limiting should be implemented.
š Description
I have decided to include two similar issues in the same gh-issue here.
When adding a playlist to the bot and the bot then leaves (using e.g. /leave), the bot continuously adds the requested playlist songs. Another issue here is that any YouTube mix-playlist breaks the bot, since it is a infinite generating playlist. Therefore it adds infinite amount of songs.
šŖ Reproduction Steps
Issue 1 (bot continuously adds items to the queue even after leaving):
/play <YouTube playlist link>
./leave
Issue 2 (Infinite YouTube mix-playlist):
/play <YouTube mix-playlist link>
. (Only shows 25 videos in the YouTube sidebar - Take a look at the notes below)Notes:
YouTube playlists use
list=PLxxxxxxxxxx
as an parameter. YouTube mix-playlists uselist=RDxxxxxxxxxx
as an parameter. YouTube mix playlists will be different from person to person after the first song. Due to every mix being different for each user. Typically mixes are recommended on the homepage and contains 25 songs, after a song has been played/skipped one new song will be added to the end of the queue. Mix-playlists can't be played itself, without havingwatch?v=xxxx
defined aswell. Therefore there should always be an initial video.ā¹ Environment / Computer Info
main@fcf933818a5e754f5ad4217aec8bfb16935d7442
ubuntu-server-22.04-arm
šø Screenshots
No response