Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
81407b51ee | ||
|
|
a3a45cb308 | ||
|
|
e0e1638327 | ||
|
|
c4fffad027 | ||
|
|
618edf65ab | ||
|
|
c5b8eb06c6 | ||
|
|
4f44bdd037 | ||
|
|
32bfbd3791 |
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "voice-to-notes",
|
||||
"version": "0.2.42",
|
||||
"version": "0.2.46",
|
||||
"description": "Desktop app for transcribing audio/video with speaker identification",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "voice-to-notes"
|
||||
version = "0.2.42"
|
||||
version = "0.2.46"
|
||||
description = "Voice to Notes — desktop transcription with speaker identification"
|
||||
authors = ["Voice to Notes Contributors"]
|
||||
license = "MIT"
|
||||
|
||||
@@ -50,9 +50,37 @@ pub fn extract_audio(file_path: String, output_path: Option<String>) -> Result<S
|
||||
#[cfg(target_os = "windows")]
|
||||
cmd.creation_flags(0x08000000);
|
||||
|
||||
let status = cmd
|
||||
let status = match cmd.status() {
|
||||
Ok(s) => s,
|
||||
Err(e) if e.raw_os_error() == Some(13) => {
|
||||
// Permission denied — fix permissions and retry
|
||||
eprintln!("[media] Permission denied on ffmpeg, fixing permissions and retrying...");
|
||||
#[cfg(unix)]
|
||||
{
|
||||
use std::os::unix::fs::PermissionsExt;
|
||||
if let Ok(meta) = std::fs::metadata(&ffmpeg) {
|
||||
let mut perms = meta.permissions();
|
||||
perms.set_mode(0o755);
|
||||
let _ = std::fs::set_permissions(&ffmpeg, perms);
|
||||
}
|
||||
// Also fix ffprobe if it exists
|
||||
let ffprobe = ffmpeg.replace("ffmpeg", "ffprobe");
|
||||
if let Ok(meta) = std::fs::metadata(&ffprobe) {
|
||||
let mut perms = meta.permissions();
|
||||
perms.set_mode(0o755);
|
||||
let _ = std::fs::set_permissions(&ffprobe, perms);
|
||||
}
|
||||
}
|
||||
Command::new(&ffmpeg)
|
||||
.args(["-y", "-i", &file_path, "-vn", "-acodec", "pcm_s16le", "-ar", "22050", "-ac", "1"])
|
||||
.arg(output.to_str().unwrap())
|
||||
.stdout(std::process::Stdio::null())
|
||||
.stderr(std::process::Stdio::piped())
|
||||
.status()
|
||||
.map_err(|e| format!("Failed to run ffmpeg: {e}"))?;
|
||||
.map_err(|e| format!("Failed to run ffmpeg after chmod: {e}"))?
|
||||
}
|
||||
Err(e) => return Err(format!("Failed to run ffmpeg: {e}")),
|
||||
};
|
||||
|
||||
if !status.success() {
|
||||
return Err(format!("ffmpeg exited with status {status}"));
|
||||
@@ -99,16 +127,6 @@ fn find_ffmpeg() -> Option<String> {
|
||||
};
|
||||
let ffmpeg_path = sidecar_dir.join(ffmpeg_name);
|
||||
if ffmpeg_path.exists() {
|
||||
// Ensure execute permission on Unix
|
||||
#[cfg(unix)]
|
||||
{
|
||||
use std::os::unix::fs::PermissionsExt;
|
||||
if let Ok(meta) = std::fs::metadata(&ffmpeg_path) {
|
||||
let mut perms = meta.permissions();
|
||||
perms.set_mode(0o755);
|
||||
let _ = std::fs::set_permissions(&ffmpeg_path, perms);
|
||||
}
|
||||
}
|
||||
return Some(ffmpeg_path.to_string_lossy().to_string());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -197,15 +197,21 @@ pub async fn download_sidecar(app: AppHandle, variant: String) -> Result<(), Str
|
||||
let extract_dir = data_dir.join(format!("sidecar-{}", sidecar_version));
|
||||
SidecarManager::extract_zip(&zip_path, &extract_dir)?;
|
||||
|
||||
// Make the binary executable on Unix
|
||||
// Make all binaries executable on Unix (sidecar, ffmpeg, ffprobe, etc.)
|
||||
#[cfg(unix)]
|
||||
{
|
||||
use std::os::unix::fs::PermissionsExt;
|
||||
let binary_path = extract_dir.join("voice-to-notes-sidecar");
|
||||
if let Ok(meta) = std::fs::metadata(&binary_path) {
|
||||
if let Ok(entries) = std::fs::read_dir(&extract_dir) {
|
||||
for entry in entries.flatten() {
|
||||
let path = entry.path();
|
||||
if path.is_file() {
|
||||
if let Ok(meta) = std::fs::metadata(&path) {
|
||||
let mut perms = meta.permissions();
|
||||
perms.set_mode(0o755);
|
||||
let _ = std::fs::set_permissions(&binary_path, perms);
|
||||
let _ = std::fs::set_permissions(&path, perms);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -113,16 +113,8 @@ impl SidecarManager {
|
||||
));
|
||||
}
|
||||
|
||||
// Make executable on Unix
|
||||
#[cfg(unix)]
|
||||
{
|
||||
use std::os::unix::fs::PermissionsExt;
|
||||
if let Ok(meta) = std::fs::metadata(&binary_path) {
|
||||
let mut perms = meta.permissions();
|
||||
perms.set_mode(0o755);
|
||||
let _ = std::fs::set_permissions(&binary_path, perms);
|
||||
}
|
||||
}
|
||||
Self::set_executable_permissions(&extract_dir);
|
||||
|
||||
Self::cleanup_old_sidecars(data_dir, ¤t_version);
|
||||
Ok(binary_path)
|
||||
@@ -207,6 +199,24 @@ impl SidecarManager {
|
||||
|
||||
/// Remove old sidecar-* directories that don't match the current version.
|
||||
/// Called after the current version's sidecar is confirmed ready.
|
||||
/// Set execute permissions on all files in a directory (Unix only).
|
||||
#[cfg(unix)]
|
||||
fn set_executable_permissions(dir: &Path) {
|
||||
use std::os::unix::fs::PermissionsExt;
|
||||
if let Ok(entries) = std::fs::read_dir(dir) {
|
||||
for entry in entries.flatten() {
|
||||
let path = entry.path();
|
||||
if path.is_file() {
|
||||
if let Ok(meta) = std::fs::metadata(&path) {
|
||||
let mut perms = meta.permissions();
|
||||
perms.set_mode(0o755);
|
||||
let _ = std::fs::set_permissions(&path, perms);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn cleanup_old_sidecars(data_dir: &Path, current_version: &str) {
|
||||
let current_dir_name = format!("sidecar-{}", current_version);
|
||||
|
||||
@@ -321,13 +331,41 @@ impl SidecarManager {
|
||||
#[cfg(target_os = "windows")]
|
||||
cmd.creation_flags(0x08000000);
|
||||
|
||||
let child = cmd
|
||||
.spawn()
|
||||
.map_err(|e| format!("Failed to start sidecar binary: {e}"))?;
|
||||
|
||||
match cmd.spawn() {
|
||||
Ok(child) => {
|
||||
self.attach(child)?;
|
||||
self.wait_for_ready()
|
||||
}
|
||||
Err(e) if e.raw_os_error() == Some(13) => {
|
||||
// Permission denied — fix permissions and retry once
|
||||
eprintln!("[sidecar-rs] Permission denied, fixing permissions and retrying...");
|
||||
#[cfg(unix)]
|
||||
if let Some(dir) = path.parent() {
|
||||
Self::set_executable_permissions(dir);
|
||||
}
|
||||
let mut retry_cmd = Command::new(path);
|
||||
retry_cmd
|
||||
.stdin(Stdio::piped())
|
||||
.stdout(Stdio::piped())
|
||||
.stderr(if let Some(data_dir) = DATA_DIR.get() {
|
||||
let log_path = data_dir.join("sidecar.log");
|
||||
std::fs::File::create(&log_path)
|
||||
.map(Stdio::from)
|
||||
.unwrap_or_else(|_| Stdio::inherit())
|
||||
} else {
|
||||
Stdio::inherit()
|
||||
});
|
||||
#[cfg(target_os = "windows")]
|
||||
retry_cmd.creation_flags(0x08000000);
|
||||
let child = retry_cmd
|
||||
.spawn()
|
||||
.map_err(|e| format!("Failed to start sidecar binary after chmod: {e}"))?;
|
||||
self.attach(child)?;
|
||||
self.wait_for_ready()
|
||||
}
|
||||
Err(e) => Err(format!("Failed to start sidecar binary: {e}")),
|
||||
}
|
||||
}
|
||||
|
||||
/// Spawn the Python sidecar in dev mode (system Python).
|
||||
fn start_python_dev(&self) -> Result<(), String> {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"$schema": "https://schema.tauri.app/config/2",
|
||||
"productName": "Voice to Notes",
|
||||
"version": "0.2.42",
|
||||
"version": "0.2.46",
|
||||
"identifier": "com.voicetonotes.app",
|
||||
"build": {
|
||||
"beforeDevCommand": "npm run dev",
|
||||
|
||||
Reference in New Issue
Block a user