-
Notifications
You must be signed in to change notification settings - Fork 120
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
Offer youtube-dlc as an alternative to youtube-dl #1
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR, it'll be useful to support this as a drop in.
I've made some comments around what feature flags to use, and how -- mainly to minimise friction.
@@ -135,6 +136,8 @@ driver = [ | |||
"url", | |||
"xsalsa20poly1305", | |||
] | |||
youtube-dl = [] | |||
youtube-dlc = [] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think just youtube-dlc
will suffice: see below.
build.rs
Outdated
If you are unsure, go with `youtube-dl`, however, if you encounter any errors with `youtube-dl`, | ||
such as tracks ending immedietly when they are queued/played, try 'youtube-dlc'." | ||
); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you add only one new feature (youtube-dl
), this check can be avoided.
In general, it's better to avoid adding in feature traps/incompatibilities where you can.
src/input/ytdl_src.rs
Outdated
#[cfg(feature = "youtube-dl")] | ||
const YOUTUBE_DL_COMMAND: &str = "youtube-dl"; | ||
#[cfg(feature = "youtube-dlc")] | ||
const YOUTUBE_DL_COMMAND: &str = "youtube-dlc"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you make this so that the default is "youtube-dl"
, and the youtube-dlc
feature changes this?
E.g., constant computation allows constructs such as:
const TEST: &str = if cfg!(feature = "") {
"A"
} else {
"B"
};
src/input/ytdl_src.rs
Outdated
/// Creates a streamed audio source with `youtube-dl` and `ffmpeg`. | ||
#[cfg(any(feature = "youtube-dl", feature = "youtube-dlc"))] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With one override feature, this check is unnecessary. This also stops Restartable
sources from failing to compile.
src/input/ytdl_src.rs
Outdated
@@ -102,6 +108,7 @@ pub(crate) async fn _ytdl(uri: &str, pre_args: &[&str]) -> Result<Input> { | |||
|
|||
/// Creates a streamed audio source from YouTube search results with `youtube-dl`,`ffmpeg`, and `ytsearch`. | |||
/// Takes the first video listed from the YouTube search. | |||
#[cfg(any(feature = "youtube-dl", feature = "youtube-dlc"))] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See the previous instance,
Lgtm. Thanks! |
Update to next + fix queue + fix clippy
serenity-rs/serenity#1076