{"record":{"id":"18957676d3355115","repo":"tonhowtf/omniget","slug":"gallery-dl-nao-esta-instalado","errorCode":null,"errorMessage":"gallery-dl nao esta instalado","messagePattern":"gallery-dl nao esta instalado","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src-tauri/omniget-core/src/core/tools/gallery.rs","lineNumber":50,"sourceCode":"}\n\n#[derive(Debug, Clone, Serialize)]\npub struct GalleryResult {\n    pub files: Vec<String>,\n    pub dest: String,\n    pub log_tail: String,\n}\n\npub async fn download(\n    url: &str,\n    dest: &str,\n    cookies_file: Option<&str>,\n    progress: super::ProgressFn,\n) -> anyhow::Result<GalleryResult> {\n    use tokio::io::{AsyncBufReadExt, BufReader};\n    let bin = crate::core::dependencies::ensure_gallerydl()\n        .await\n        .ok_or_else(|| anyhow!(\"gallery-dl nao esta instalado\"))?;\n    std::fs::create_dir_all(dest)?;\n    let mut cmd = crate::core::process::command(&bin);\n    cmd.args([\"-d\", dest, \"--write-metadata\"]);\n    if let Some(c) = cookies_file.filter(|c| !c.trim().is_empty()) {\n        cmd.args([\"--cookies\", c]);\n    }\n    cmd.arg(url)\n        .stdin(std::process::Stdio::null())\n        .stdout(std::process::Stdio::piped())\n        .stderr(std::process::Stdio::piped());\n    let mut child = cmd\n        .spawn()\n        .map_err(|e| anyhow!(\"nao foi possivel iniciar o gallery-dl: {}\", e))?;\n    let stdout = child.stdout.take();\n    let stderr = child.stderr.take();\n    let id = format!(\"gallery:{}\", url);\n    let p2 = progress.clone();\n    let id2 = id.clone();","sourceCodeStart":32,"sourceCodeEnd":68,"githubUrl":"https://github.com/tonhowtf/omniget/blob/8600b91f4246848bac346874daa9e61c1fc5677a/src-tauri/omniget-core/src/core/tools/gallery.rs#L32-L68","documentation":"Dependency check failure in the gallery downloader: download() calls ensure_gallerydl() which locates (or installs) the gallery-dl binary; when that returns None the download aborts before creating the destination or spawning the process. It fires when gallery-dl cannot be found or provisioned — not installed, not on PATH, or its auto-install step failed.","triggerScenarios":"Calling download() when gallery-dl is absent from PATH and could not be downloaded/located automatically.","commonSituations":"User skipped the install step; gallery-dl uninstalled after install; PATH changed in the spawned environment; auto-download blocked offline.","solutions":["Run the app's gallery install action (gallery::install) first","Install gallery-dl manually: pip install gallery-dl, or grab the standalone exe into PATH","Confirm `gallery-dl --version` works from a terminal with the same PATH"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":"// check binary presence before downloading\nlet ok = which::which(\"gallery-dl\").is_ok()\n    || crate::core::dependencies::ensure_gallerydl().await.is_some();","typeGuard":null,"tryCatchPattern":"match gallery::download(url, dest, cookies, progress).await {\n    Ok(r) => r,\n    Err(e) if e.to_string().contains(\"nao esta instalado\") => {\n        gallery::install().await?;\n        gallery::download(url, dest, cookies, progress).await?\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Run the install step once at first use instead of at download time","Verify gallery-dl presence at app startup and prompt the user early","Pin a known-good gallery-dl version in your install path"],"tags":["gallery-dl","missing-dependency","setup"],"backgroundTag":"missing-dependency","analyzedSha":"8600b91f4246848bac346874daa9e61c1fc5677a","analyzedAt":"2026-09-12T14:29:19.317Z","contentChangedAt":"2026-09-12T14:29:19.317Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}