feat #14740: settings, keyring, tray and manual recording
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -162,6 +162,17 @@ impl Store {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Sets the track file paths, for callers that derive them from the
|
||||
/// call id and so can only know them after [`Store::create_call`].
|
||||
pub fn set_paths(&self, id: CallId, mic_path: &Path, out_path: &Path) -> Result<()> {
|
||||
let conn = self.conn.lock().unwrap();
|
||||
conn.execute(
|
||||
"UPDATE calls SET mic_path = ?1, out_path = ?2 WHERE id = ?3",
|
||||
params![path_to_str(mic_path)?, path_to_str(out_path)?, id],
|
||||
)?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn set_status(&self, id: CallId, status: CallStatus, error: Option<&str>) -> Result<()> {
|
||||
let conn = self.conn.lock().unwrap();
|
||||
conn.execute(
|
||||
@@ -495,7 +506,7 @@ fn speaker_from_key(key: &str) -> Result<Speaker> {
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use std::collections::BTreeMap;
|
||||
use std::path::Path;
|
||||
use std::path::{Path, PathBuf};
|
||||
|
||||
use chrono::Local;
|
||||
|
||||
@@ -744,6 +755,22 @@ mod tests {
|
||||
assert_eq!(recovered.ended_at, Some(original_ended_at));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn set_paths_updates_track_paths() {
|
||||
let store = Store::open_in_memory().unwrap();
|
||||
let id = store
|
||||
.create_call("Manuell", Local::now(), Path::new(""), Path::new(""))
|
||||
.unwrap();
|
||||
|
||||
store
|
||||
.set_paths(id, Path::new("/rec/1-mic.wav"), Path::new("/rec/1-out.wav"))
|
||||
.unwrap();
|
||||
|
||||
let call = store.get_call(id).unwrap().unwrap();
|
||||
assert_eq!(call.mic_path, PathBuf::from("/rec/1-mic.wav"));
|
||||
assert_eq!(call.out_path, PathBuf::from("/rec/1-out.wav"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn delete_call_cascades() {
|
||||
let store = Store::open_in_memory().unwrap();
|
||||
|
||||
Reference in New Issue
Block a user