romsom / python-jackdbus

Python library to manage JACK connections from python via DBUS and cli geek tool to create/break multiple connections at once using regular expressions.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

python-jackdbus

Python library to manage JACK connections from python via DBUS and cli geek tool to create/break multiple connections at once using regular expressions.

usage: jack_re_connect [-h] [--sclient SCLIENT] [--sport SPORT]
                       [--dclient DCLIENT] [--dport DPORT]
                       [--number-of-ports NUMBER_OF_PORTS] [--sstart SSTART]
                       [--dstart DSTART]
                       {connect,disconnect}

Connect/disconnect jack ports consecutively by matching them with regular
expressions.

positional arguments:
  {connect,disconnect}  Should the ports be connected or disconnected?

options:
  -h, --help            show this help message and exit
  --sclient SCLIENT     Regex for the source jack client
  --sport SPORT         Regex for the source jack port
  --dclient DCLIENT     Regex for the destination jack client
  --dport DPORT         Regex for the destination jack port
  --number-of-ports NUMBER_OF_PORTS, -n NUMBER_OF_PORTS
                        Limit the number of consecutive connections to
                        NUMBER_OF_PORTS
  --sstart SSTART       The index of the first source match to be connected
  --dstart DSTART       The index of the first destination match to be
                        connected

Examples

You can use regular expressions to short cut long names and to select multiple ports at once:

python -m jackdbus connect --sclient 'setBfree.*' --sport 'out[LR]' --dclient system --dport 'playback_[56]'
connecting [setBfree DSP Tonewheel Organ:outL] -> [system:playback_5]
connecting [setBfree DSP Tonewheel Organ:outR] -> [system:playback_6]

If the regexes match more than one source and destination port, consecutive pairs will be connected.

You can also specify which matching port should be the first to be connected on either side (0-based):

python -m jackdbus connect --sclient 'setBfree.*' --sport 'out[LR]' --dclient system --dport 'playback_.*' --dstart 4
connecting [setBfree DSP Tonewheel Organ:outL] -> [system:playback_5]
connecting [setBfree DSP Tonewheel Organ:outR] -> [system:playback_6]

If on either side there are more matching port than on the other, only pairs up to the minimum number will be connected or disconnected.

Regexes don’t have to match the whole name:

python -m jackdbus connect --sclient system --sport 'capture_' --dclient system --dport 'playback_' --sstart 2 --dstart 5 -n 4
connecting [system:capture_3] -> [system:playback_6]
connecting [system:capture_4] -> [system:playback_7]
connecting [system:capture_5] -> [system:playback_8]
connecting [system:capture_6] -> [system:playback_9]

Here -n 4 limits the number of connections to 4.

You still can match the whole client or port name. You can also leave out port regexes, if you want to match all ports.

python -m jackdbus disconnect --sclient '^system$' --dclient '^system$' --sstart 2 --dstart 5 -n 4
disconnecting [system:capture_3] -|> [system:playback_6]
disconnecting [system:capture_4] -|> [system:playback_7]
disconnecting [system:capture_5] -|> [system:playback_8]
disconnecting [system:capture_6] -|> [system:playback_9]

You can also leave out client regexes if you want to connect to system ports:

python -m jackdbus connect --sstart 2 --dstart 5 -n 4
connecting [system:capture_3] -> [system:playback_6]
connecting [system:capture_4] -> [system:playback_7]
connecting [system:capture_5] -> [system:playback_8]
connecting [system:capture_6] -> [system:playback_9]

About

Python library to manage JACK connections from python via DBUS and cli geek tool to create/break multiple connections at once using regular expressions.

License:BSD 2-Clause "Simplified" License


Languages

Language:Python 100.0%