diff --git a/src/commands/play.rs b/src/commands/play.rs index a4502b1a..dc7bdd7e 100644 --- a/src/commands/play.rs +++ b/src/commands/play.rs @@ -217,8 +217,9 @@ pub async fn play( .ok_or(ParrotError::Other("failed to fetch playlist"))?; for url in urls.iter() { - let queue = - enqueue_track(&call, &QueryType::VideoLink(url.to_string())).await?; + let Ok(queue) = enqueue_track(&call, &QueryType::VideoLink(url.to_string())).await else { + continue; + }; update_queue_messages(&ctx.http, &ctx.data, &queue, guild_id).await; } } @@ -248,7 +249,9 @@ pub async fn play( .ok_or(ParrotError::Other("failed to fetch playlist"))?; for (idx, url) in urls.into_iter().enumerate() { - let queue = insert_track(&call, &QueryType::VideoLink(url), idx + 1).await?; + let Ok(queue) = insert_track(&call, &QueryType::VideoLink(url), idx + 1).await else { + continue; + }; update_queue_messages(&ctx.http, &ctx.data, &queue, guild_id).await; } } @@ -285,8 +288,9 @@ pub async fn play( let mut insert_idx = 1; for (i, url) in urls.into_iter().enumerate() { - let mut queue = - insert_track(&call, &QueryType::VideoLink(url), insert_idx).await?; + let Ok(mut queue) = insert_track(&call, &QueryType::VideoLink(url), insert_idx).await else { + continue; + }; if i == 0 && !queue_was_empty { queue = force_skip_top_track(&call.lock().await).await?; @@ -327,7 +331,9 @@ pub async fn play( .ok_or(ParrotError::Other("failed to fetch playlist"))?; for url in urls.into_iter() { - let queue = enqueue_track(&call, &QueryType::VideoLink(url)).await?; + let Ok(queue) = enqueue_track(&call, &QueryType::VideoLink(url)).await else { + continue; + }; update_queue_messages(&ctx.http, &ctx.data, &queue, guild_id).await; } } diff --git a/src/sources/youtube.rs b/src/sources/youtube.rs index 5cabf0c8..9c4c7bc1 100644 --- a/src/sources/youtube.rs +++ b/src/sources/youtube.rs @@ -23,7 +23,7 @@ pub struct YouTube {} impl YouTube { pub fn extract(query: &str) -> Option { - if query.contains("playlist?list=") { + if query.contains("list=") { Some(QueryType::PlaylistLink(query.to_string())) } else { Some(QueryType::VideoLink(query.to_string())) @@ -124,6 +124,7 @@ async fn ytdl(uri: &str) -> Result<(Child, Metadata), SongbirdError> { "infinite", // infinite number of download retries "--no-playlist", // only download the video if URL also has playlist info "--ignore-config", // disable all configuration files for a yt-dlp run + "--no-warnings", // don't print out warnings uri, "-o", "-", // stream data to stdout @@ -173,6 +174,7 @@ async fn _ytdl_metadata(uri: &str) -> SongbirdResult { "infinite", // infinite number of download retries "--no-playlist", // only download the video if URL also has playlist info "--ignore-config", // disable all configuration files for a yt-dlp run + "--no-warnings", // don't print out warnings uri, "-o", "-", // stream data to stdout