mirror of
https://github.com/thegeneralist01/archivr
synced 2026-03-10 02:30:29 +01:00
refactor: rename youtube downloader to ytdlp
More generic name since yt-dlp supports many sites beyond YouTube.
This commit is contained in:
parent
955a5037e9
commit
60727c0f1e
2 changed files with 5 additions and 3 deletions
|
|
@ -1 +1,2 @@
|
||||||
pub mod youtube;
|
pub mod local;
|
||||||
|
pub mod ytdlp;
|
||||||
|
|
|
||||||
|
|
@ -4,12 +4,13 @@ use std::{env, path::Path, process::Command};
|
||||||
use crate::hash::hash_file;
|
use crate::hash::hash_file;
|
||||||
|
|
||||||
pub fn download(path: String, store_path: &Path, timestamp: &String) -> Result<String> {
|
pub fn download(path: String, store_path: &Path, timestamp: &String) -> Result<String> {
|
||||||
println!("Downloading from YouTube: {path}");
|
println!("Downloading with yt-dlp: {path}");
|
||||||
|
|
||||||
let ytdlp = env::var("ARCHIVR_YT_DLP").unwrap_or_else(|_| "yt-dlp".to_string());
|
let ytdlp = env::var("ARCHIVR_YT_DLP").unwrap_or_else(|_| "yt-dlp".to_string());
|
||||||
|
|
||||||
let temp_dir = store_path.join("temp");
|
let temp_dir = store_path.join("temp").join(timestamp);
|
||||||
std::fs::create_dir_all(&temp_dir)?;
|
std::fs::create_dir_all(&temp_dir)?;
|
||||||
|
|
||||||
let out_file = temp_dir.join(format!("{timestamp}.mp4"));
|
let out_file = temp_dir.join(format!("{timestamp}.mp4"));
|
||||||
|
|
||||||
let out = Command::new(&ytdlp)
|
let out = Command::new(&ytdlp)
|
||||||
Loading…
Add table
Add a link
Reference in a new issue