From 52cff419da28b66afb8f5b8f5ac91bcd7d202c18 Mon Sep 17 00:00:00 2001 From: Ki Date: Mon, 26 Sep 2022 18:47:03 +0200 Subject: [PATCH] add --show-device option to list available microphones --- whispering/cli.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/whispering/cli.py b/whispering/cli.py index 60576a0..ec2ba80 100644 --- a/whispering/cli.py +++ b/whispering/cli.py @@ -116,6 +116,10 @@ def get_opts() -> argparse.Namespace: "--mode", choices=["client"], ) + parser.add_argument( + "--show-devices", + action="store_true", + ) return parser.parse_args() @@ -137,6 +141,15 @@ def get_wshiper(*, opts): def main() -> None: opts = get_opts() + + if(opts.show_devices) : + devices = sd.query_devices() + for i, device in enumerate(devices): + if(device["max_input_channels"] > 0) : + print(f"{i}: {device['name']}") + + return + basicConfig( level=DEBUG if opts.debug else INFO, format="[%(asctime)s] %(module)s.%(funcName)s:%(lineno)d %(levelname)s -> %(message)s",