Add optoon to get audio sinks and the default audio sink.

This commit is contained in:
minecraftchest1@outlook.com 2025-04-03 13:17:56 -05:00
parent 6ddd91e339
commit d00cc46aaf

14
main.py
View file

@ -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)