rust-whisper-baked can list input devices

This commit is contained in:
Bel LaPointe
2023-12-20 22:12:35 -05:00
parent e27a8f8f56
commit 5c34112c0c
3 changed files with 26 additions and 5 deletions

View File

@@ -11,7 +11,7 @@ fn main() {
eprintln!("rust whisper baked lib channel...");
thread::spawn(move || {
rust_whisper_baked_lib::channel(
flags,
flags.clone(),
|result: Result<rust_whisper_lib::Transcribed, String>| {
match result {
Ok(transcribed) => { println!("{}", transcribed.to_string()); },
@@ -23,8 +23,24 @@ fn main() {
});
eprintln!("listen lib main...");
listen_lib::main(|data| {
send.send(data).unwrap();
});
let flags = rust_whisper_lib::Flags::parse();
match flags.stream_device {
Some(device_name) => {
if device_name == "" {
for device in listen_lib::devices() {
eprintln!("{}", device);
}
} else {
listen_lib::main_with(|data| {
send.send(data).unwrap();
}, device_name);
}
},
None => {
listen_lib::main(|data| {
send.send(data).unwrap();
});
}
}
eprintln!("/listen lib main...");
}