Open-source download manager & offline media toolbox for YouTube, music, social media, learning platforms & 1,800+ sites. Built with Tauri 2.0, Rust & Svelte.
Rust downloadmanagerguihacktoberfesthomebrewlightweightlinuxlinux-distributionlocal-firstmacosmacos-packagemedia-toolboxopen-sourcerustsveltetauritrendingtrending-repositorieswindowswindows-desktopytdlp
feat: add async function to check for yt-dlp updates and reset cache on success
Tonho7316d64f25bc
diff --git a/src-tauri/omniget-core/src/core/ytdlp.rs b/src-tauri/omniget-core/src/core/ytdlp.rsindex dade45dc..cd28b471 100644--- a/src-tauri/omniget-core/src/core/ytdlp.rs+++ b/src-tauri/omniget-core/src/core/ytdlp.rs@@ -108,6 +108,31 @@ pub fn reset_cookies_browser_cache() {}}+pub async fn check_ytdlp_update(ytdlp: &Path) -> anyhow::Result<bool> {+ if YTDLP_UPDATE_CHECKED.swap(true, Ordering::Relaxed) {+ return Ok(false);+ }++ let output = crate::core::process::command(ytdlp)+ .args(["--update-to", "nightly"])+ .stdout(Stdio::piped())+ .stderr(Stdio::piped())+ .output()+ .await?;++ let stdout = String::from_utf8_lossy(&output.stdout);+ let stderr = String::from_utf8_lossy(&output.stderr);+ let combined = format!("{}{}", stdout, stderr);++ if combined.contains("Updated yt-dlp") || combined.contains("Updating to") {+ tracing::info!("[ytdlp] updated: {}", combined.trim());+ reset_ytdlp_cache();+ Ok(true)+ } else {+ Ok(false)+ }+}+fn proxy_args() -> Vec<String> {match crate::core::http_client::proxy_url() {Some(url) => vec!["--proxy".to_string(), url],