saysynth.cli.commands.list

List all currently running saysynth processes.

 1"""
 2List all currently running `saysynth` processes.
 3"""
 4import click
 5
 6from saysynth.cli.colors import blue, green, red, yellow
 7from saysynth.core import controller
 8
 9
10def run(**kwargs):
11    pids = controller.list_pids()
12    if not len(pids):
13        click.echo(red("There are no active processes!"))
14        return
15    last_seq = None
16    for p in pids:
17        seq = p["seq"]
18        if last_seq != seq:
19            click.echo(r"-" * 79, err=True)
20            click.echo(f"{red('sequence')}: {green(seq)}")
21            click.echo(r"-" * 79, err=True)
22        click.echo(
23            f"➡️ {yellow('track')}: {blue(p['track']).ljust(23)} {yellow('audio_device')}: {blue(p['ad']).ljust(18)} {yellow('parent_pid')}: {blue(p['parent_pid']).ljust(14)} {yellow('child_pids')}: {blue(len(p['child_pids']))}"
24        )
25        last_seq = seq
26
27
28@click.command()
29def cli(**kwargs):
30    """
31    List all currently running `saysynth` processes.
32    """
33    run(**kwargs)
def run(**kwargs):
11def run(**kwargs):
12    pids = controller.list_pids()
13    if not len(pids):
14        click.echo(red("There are no active processes!"))
15        return
16    last_seq = None
17    for p in pids:
18        seq = p["seq"]
19        if last_seq != seq:
20            click.echo(r"-" * 79, err=True)
21            click.echo(f"{red('sequence')}: {green(seq)}")
22            click.echo(r"-" * 79, err=True)
23        click.echo(
24            f"➡️ {yellow('track')}: {blue(p['track']).ljust(23)} {yellow('audio_device')}: {blue(p['ad']).ljust(18)} {yellow('parent_pid')}: {blue(p['parent_pid']).ljust(14)} {yellow('child_pids')}: {blue(len(p['child_pids']))}"
25        )
26        last_seq = seq
cli = <Command cli>

List all currently running saysynth processes.