diff options
| author | Nathan Perry <avaglir@gmail.com> | 2019-02-17 01:59:22 -0500 |
|---|---|---|
| committer | Nathan Perry <avaglir@gmail.com> | 2019-02-17 01:59:22 -0500 |
| commit | e9e3458225cfc0fdc20a7d2960ef15d4de349802 (patch) | |
| tree | 036dbf021aafb2479faae487c9d71f8d1b0f2e43 /src/audio/ytdl.rs | |
| parent | 27ab061563de6c7d1b79dccd8585655ef8aa9700 (diff) | |
support audio memes
Diffstat (limited to 'src/audio/ytdl.rs')
| -rw-r--r-- | src/audio/ytdl.rs | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/audio/ytdl.rs b/src/audio/ytdl.rs index d16d166..8384db4 100644 --- a/src/audio/ytdl.rs +++ b/src/audio/ytdl.rs @@ -42,7 +42,7 @@ impl Drop for ChildContainer { } } -pub fn ytdl(uri: &str, start: Option<Duration>, end: Option<Duration>) -> Result<Box<AudioSource>> { +pub fn ytdl_reader(uri: &str, start: Option<Duration>, end: Option<Duration>) -> Result<Box<dyn Read + Send>> { let args = [ "-f", "webm[abr>0]/bestaudio/best", @@ -113,5 +113,10 @@ pub fn ytdl(uri: &str, start: Option<Duration>, end: Option<Duration>) -> Result .stdout(Stdio::piped()) .spawn()?; - Ok(pcm(true, ChildContainer(command))) + Ok(Box::new(ChildContainer(command))) +} + +pub fn ytdl(uri: &str, start: Option<Duration>, end: Option<Duration>) -> Result<Box<AudioSource>> { + let command = ytdl_reader(uri, start, end)?; + Ok(pcm(true, command)) } |
