no panic on unusable mic

This commit is contained in:
bel
2024-01-03 17:09:27 -07:00
parent 9780c6f2ef
commit 53e675b9a0
2 changed files with 12 additions and 3 deletions

View File

@@ -68,10 +68,14 @@ fn channel(flags: rust_whisper_lib::Flags) {
let flags = rust_whisper_lib::Flags::parse();
match flags.stream_device {
Some(device_name) => {
if device_name == "" {
eprintln!("with device ({}) '{}'", device_name.len(), &device_name);
if device_name.len() == 0 {
let mut i = 0;
for device in listen_lib::devices() {
eprintln!("{}", device);
eprintln!("[{}] {}", i, device);
i += 1;
}
eprintln!("found {} devices", i);
} else {
listen_lib::main_with(|data| {
send.send(data).unwrap();
@@ -79,6 +83,7 @@ fn channel(flags: rust_whisper_lib::Flags) {
}
},
None => {
eprintln!("without any device");
listen_lib::main(|data| {
send.send(data).unwrap();
});