Update __main__.py
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.
This commit is contained in:
@@ -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():
|
||||
|
||||
Reference in New Issue
Block a user