mirror of
https://github.com/thegeneralist01/archivr
synced 2026-07-21 18:55:36 +02:00
fix: emit yt-dlp stderr on fetch_metadata failure for debuggability
This commit is contained in:
parent
bda548e91a
commit
8b2e8172c3
1 changed files with 4 additions and 2 deletions
|
|
@ -35,8 +35,8 @@ pub fn download(path: String, store_path: &Path, timestamp: &String) -> Result<S
|
|||
/// Fetches metadata JSON for `path` via `yt-dlp --dump-json`.
|
||||
///
|
||||
/// This is a simulate call — it does NOT download any media.
|
||||
/// Returns `None` silently if yt-dlp fails or produces no output,
|
||||
/// so callers can proceed with the download regardless.
|
||||
/// On failure (non-zero exit or no stdout), prints the captured stderr
|
||||
/// to stderr (for debugging) then returns `None` so callers can proceed.
|
||||
pub fn fetch_metadata(path: &str) -> Option<String> {
|
||||
let ytdlp = std::env::var("ARCHIVR_YT_DLP").unwrap_or_else(|_| "yt-dlp".to_string());
|
||||
|
||||
|
|
@ -47,6 +47,8 @@ pub fn fetch_metadata(path: &str) -> Option<String> {
|
|||
.ok()?;
|
||||
|
||||
if !out.status.success() {
|
||||
let stderr = String::from_utf8_lossy(&out.stderr);
|
||||
eprintln!("yt-dlp --dump-json failed for {path} (status {:?}): {stderr}", out.status);
|
||||
return None;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue