fix ffmpeg download

This commit is contained in:
Julian Freeman
2025-12-25 18:20:45 -04:00
parent 36bd5061a4
commit f4bdb85841
7 changed files with 13 additions and 16 deletions

2
src-tauri/Cargo.lock generated
View File

@@ -3971,7 +3971,7 @@ checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f"
[[package]]
name = "stream-capture"
version = "0.1.0"
version = "1.0.1"
dependencies = [
"anyhow",
"chrono",

View File

@@ -1,6 +1,6 @@
[package]
name = "stream-capture"
version = "0.1.0"
version = "1.0.1"
description = "A Tauri App"
authors = ["you"]
edition = "2021"

View File

@@ -308,17 +308,19 @@ pub async fn download_ffmpeg(app: &AppHandle) -> Result<PathBuf> {
for asset in assets {
if let (Some(name), Some(url)) = (asset.get("name").and_then(|n| n.as_str()), asset.get("browser_download_url").and_then(|u| u.as_str())) {
let lname = name.to_lowercase();
if lname.contains("win64") && lname.ends_with(".zip") {
// Prefer GPL static build, avoid shared to get a single exe
if lname.contains("win64") && lname.contains("gpl") && !lname.contains("shared") && lname.ends_with(".zip") {
download_url = Some(url.to_string());
break;
}
}
}
if download_url.is_none() {
// fallback: choose first zip asset
// fallback: choose first zip asset that is NOT shared if possible
for asset in assets {
if let (Some(url), Some(name)) = (asset.get("browser_download_url").and_then(|u| u.as_str()), asset.get("name").and_then(|n| n.as_str())) {
if name.to_lowercase().ends_with(".zip") {
let lname = name.to_lowercase();
if lname.ends_with(".zip") && !lname.contains("shared") {
download_url = Some(url.to_string());
break;
}
@@ -341,7 +343,8 @@ pub async fn download_ffmpeg(app: &AppHandle) -> Result<PathBuf> {
if file.is_dir() { continue; }
let name = file.name().to_string();
let filename_only = name.split('/').last().unwrap_or("");
if filename_only.eq_ignore_ascii_case("ffmpeg.exe") || filename_only.ends_with(".dll") {
// Only extract the executable, ignore DLLs
if filename_only.eq_ignore_ascii_case("ffmpeg.exe") {
let mut out_file = fs::File::create(bin_dir.join(filename_only))?;
std::io::copy(&mut file, &mut out_file)?;
found = true;

View File

@@ -1,7 +1,7 @@
{
"$schema": "https://schema.tauri.app/config/2",
"productName": "StreamCapture",
"version": "1.0.0",
"productName": "流萤-视频下载",
"version": "1.0.1",
"identifier": "top.volan.stream-capture",
"build": {
"beforeDevCommand": "pnpm dev",
@@ -13,7 +13,7 @@
"windows": [
{
"label": "main",
"title": "流萤 - 视频下载 v1.0.0",
"title": "流萤 - 视频下载 v1.0.1",
"width": 1300,
"height": 900,
"visible": false