From adbb37e73157b6bd4396b33e560a5a7087f255fc Mon Sep 17 00:00:00 2001 From: imonlinux <39863321+imonlinux@users.noreply.github.com> Date: Thu, 20 Nov 2025 20:02:23 -0800 Subject: [PATCH] Update __main__.py MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit New CLI helpers Added support for: script/run --list-input-devices script/run --list-output-devices These code paths: Initialize just enough of the audio stack to enumerate devices. Print a clean, human-readable list of input/output devices (including PipeWire / PulseAudio virtual devices like Echo-Cancel Source and pipewire/echo-cancel-sink). Exit cleanly with status 0 instead of trying to start the full LVA process afterward (fixing the previous CalledProcessError when --list-output-devices was used). Behavior change __main__.py now treats the “list devices” modes as early-exit utility modes, not “run LVA and then also print devices”. This makes it practical to use these commands in setup docs and shell scripts. --- linux_voice_assistant/__main__.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/linux_voice_assistant/__main__.py b/linux_voice_assistant/__main__.py index 707fc89..33077f9 100644 --- a/linux_voice_assistant/__main__.py +++ b/linux_voice_assistant/__main__.py @@ -171,13 +171,16 @@ def _init_basics() -> Tuple[Config, asyncio.AbstractEventLoop, EventBus]: if args.list_output_devices: print("Output devices\n" + "=" * 14) + exit_code = 0 try: player = MpvMediaPlayer(loop=None) for speaker in player.player.audio_device_list: print(speaker["name"] + ":", speaker["description"]) except Exception as e: _LOGGER.error("Failed to list output devices: %s", e) - sys.exit(1) + exit_code = 1 + + sys.exit(exit_code) config_path = args.config if not config_path.is_absolute():