From d00cc46aaf4fa1b3a79e75dfc9967d5d4b072e4b Mon Sep 17 00:00:00 2001 From: "minecraftchest1@outlook.com" Date: Thu, 3 Apr 2025 13:17:56 -0500 Subject: [PATCH] Add optoon to get audio sinks and the default audio sink. --- main.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/main.py b/main.py index 9be1533..7177bb7 100644 --- a/main.py +++ b/main.py @@ -24,8 +24,6 @@ def bluetooth_connect(args): print("%s",process.stderr) def pipewire_list(args): - print(args) - print("ID | Description") print("----------------") @@ -33,6 +31,13 @@ def pipewire_list(args): for sink in sinks: print(str(sink['id']) + " | " + sink['info']['props']['node.description']) +def pipewire_get_default_sink(args): + print("ID | Description") + print("----------------") + + sink = Pipewire.get_default_audio_sink() + print(str(sink['id']) + " | " + sink['info']['props']['node.description']) + def main(): argparser = argparse.ArgumentParser(description='CarPI CLI.') @@ -44,11 +49,14 @@ def main(): action_bt_connect = actions.add_parser('bluetooth-connect', help='connect to a bluetooth device') action_bt_connect.set_defaults(func=bluetooth_connect) - action_bt_connect.add_argument('address', help='The bluetooth address of the device to connect to.') + action_bt_connect.add_argument('address', help='the bluetooth address of the device to connect to.') action_pw_list = actions.add_parser('pipewire-list', help='list pipewire objects') action_pw_list.set_defaults(func=pipewire_list) + action_pw_get_default_sink = actions.add_parser('pipewire-get-default-sink', help='show the default audio sink') + action_pw_get_default_sink.set_defaults(func=pipewire_get_default_sink) + args = argparser.parse_args() args.func(args)