Files
mumble-web2/gui/build.rs
T
2025-10-28 01:10:35 -06:00

39 lines
1.2 KiB
Rust

use std::path::Path;
use std::process::Command;
fn main() {
// Define the target directory and file
let assets_dir = "assets";
let target_file = format!("{}/DeepFilterNet3_ll_onnx.tar.gz", assets_dir);
let target_path = Path::new(&target_file);
// Check if the file already exists
if target_path.exists() {
println!("cargo:warning=DeepFilterNet model already exists at {}", target_file);
return;
}
println!("cargo:warning=Downloading DeepFilterNet model to {}...", target_file);
// Download the file using curl
let url = "https://github.com/Rikorose/DeepFilterNet/raw/refs/heads/main/models/DeepFilterNet3_ll_onnx.tar.gz";
let status = Command::new("curl")
.args([
"-L", // Follow redirects
"-o", &target_file, // Output file
url,
])
.status()
.expect("Failed to execute curl command. Make sure curl is installed.");
if !status.success() {
panic!("Failed to download DeepFilterNet model from {}", url);
}
println!("cargo:warning=Successfully downloaded DeepFilterNet model to {}", target_file);
// Rerun this build script if the target file is deleted
println!("cargo:rerun-if-changed={}", target_file);
}