mirror of
https://github.com/narrrl/ytd-rs.git
synced 2026-11-05 17:22:11 +01:00
added support for yt-dlp and youtube-dlc
This commit is contained in:
1 parent
716153853b
commit
116f5ae314
2 files changed
+14
-2
No files matched your search
+5
-1
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "ytd-rs"
|
name = "ytd-rs"
|
||||||
version = "0.1.4"
|
version = "0.1.5"
|
||||||
authors = ["Nils Pukropp <nils.pukropp@outlook.de>"]
|
authors = ["Nils Pukropp <nils.pukropp@outlook.de>"]
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
license-file ="LICENSE"
|
license-file ="LICENSE"
|
||||||
@@ -9,6 +9,10 @@ homepage = "https://github.com/Nirusu99/ytd-rs"
|
|||||||
repository = "https://github.com/Nirusu99/ytd-rs"
|
repository = "https://github.com/Nirusu99/ytd-rs"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
|
|
||||||
|
[features]
|
||||||
|
yt-dlp = []
|
||||||
|
youtube-dlc = []
|
||||||
|
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
regex = "1.5"
|
regex = "1.5"
|
||||||
+9
-1
@@ -41,6 +41,14 @@ use std::{path::Path, process::Command};
|
|||||||
|
|
||||||
type Result<T> = std::result::Result<T, YoutubeDLError>;
|
type Result<T> = std::result::Result<T, YoutubeDLError>;
|
||||||
|
|
||||||
|
const YOUTUBE_DL_COMMAND: &str = if cfg!(feature = "youtube-dlc") {
|
||||||
|
"youtube-dlc"
|
||||||
|
} else if cfg!(feature = "yt-dlp") {
|
||||||
|
"yt-dlp"
|
||||||
|
} else {
|
||||||
|
"youtube-dl"
|
||||||
|
};
|
||||||
|
|
||||||
/// A structure that represents an argument of a youtube-dl command.
|
/// A structure that represents an argument of a youtube-dl command.
|
||||||
///
|
///
|
||||||
/// There are two different kinds of Arg:
|
/// There are two different kinds of Arg:
|
||||||
@@ -246,7 +254,7 @@ impl YoutubeDL {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn spawn_youtube_dl(&self) -> Result<Output> {
|
fn spawn_youtube_dl(&self) -> Result<Output> {
|
||||||
let mut cmd = Command::new("youtube-dl");
|
let mut cmd = Command::new(YOUTUBE_DL_COMMAND);
|
||||||
cmd.current_dir(&self.path)
|
cmd.current_dir(&self.path)
|
||||||
.env("LC_ALL", "en_US.UTF-8")
|
.env("LC_ALL", "en_US.UTF-8")
|
||||||
.stdout(Stdio::piped())
|
.stdout(Stdio::piped())
|
||||||
|
|||||||
Reference in new issue
Block a user