From e270e9475664eac33bd02d472f5db8edbdb91a87 Mon Sep 17 00:00:00 2001 From: onyx-and-iris Date: Sat, 26 Apr 2025 14:18:28 +0100 Subject: [PATCH] add virtualcam typer --- obsws_cli/virtualcam.py | 43 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 obsws_cli/virtualcam.py diff --git a/obsws_cli/virtualcam.py b/obsws_cli/virtualcam.py new file mode 100644 index 0000000..6b0dff9 --- /dev/null +++ b/obsws_cli/virtualcam.py @@ -0,0 +1,43 @@ +"""module containing commands for manipulating virtual camera in OBS.""" + +import typer + +from .alias import AliasGroup + +app = typer.Typer(cls=AliasGroup) + + +@app.callback() +def main(): + """Control virtual camera in OBS.""" + + +@app.command() +def start(ctx: typer.Context): + """Start the virtual camera.""" + ctx.obj.start_virtual_cam() + typer.echo('Virtual camera started.') + + +@app.command() +def stop(ctx: typer.Context): + """Stop the virtual camera.""" + ctx.obj.stop_virtual_cam() + typer.echo('Virtual camera stopped.') + + +@app.command() +def toggle(ctx: typer.Context): + """Toggle the virtual camera.""" + ctx.obj.toggle_virtual_cam() + typer.echo('Virtual camera toggled.') + + +@app.command() +def status(ctx: typer.Context): + """Get the status of the virtual camera.""" + resp = ctx.obj.get_virtual_cam_status() + if resp.output_active: + typer.echo('Virtual camera is enabled.') + else: + typer.echo('Virtual camera is disabled.')