From 6fcb196e34922a7ec7e98f874a46e3c3518bfef5 Mon Sep 17 00:00:00 2001 From: Miezhiko Date: Sun, 10 Oct 2021 23:56:32 +0400 Subject: [PATCH] Input: Allows yt-dlp usage as another youtube-dl fork (#90) Signed-off-by: Miezhiko --- Cargo.toml | 1 + src/input/ytdl_src.rs | 2 ++ src/lib.rs | 3 +++ 3 files changed, 6 insertions(+) diff --git a/Cargo.toml b/Cargo.toml index 5f7534314..6b0a842e3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -221,6 +221,7 @@ tokio-02-marker = [] # Behaviour altering features. youtube-dlc = [] +yt-dlp = [] builtin-queue = [] # Used for docgen/testing/benchmarking. diff --git a/src/input/ytdl_src.rs b/src/input/ytdl_src.rs index 141cc1691..ba03dc888 100644 --- a/src/input/ytdl_src.rs +++ b/src/input/ytdl_src.rs @@ -19,6 +19,8 @@ use tracing::trace; const YOUTUBE_DL_COMMAND: &str = if cfg!(feature = "youtube-dlc") { "youtube-dlc" +} else if cfg!(feature = "yt-dlp") { + "yt-dlp" } else { "youtube-dl" }; diff --git a/src/lib.rs b/src/lib.rs index 0c09160af..d685d7e5c 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -37,6 +37,9 @@ //! [`ConnectionInfo`]: struct@ConnectionInfo //! [lavalink]: https://github.com/freyacodes/Lavalink +#[cfg(all(feature = "youtube-dlc", feature = "yt-dlp"))] +compile_error!("feature \"youtube-dlc\" and feature \"yt-dlp\" cannot be enabled at the same time"); + mod config; pub mod constants; #[cfg(feature = "driver-core")]