mirror of
https://github.com/onyx-and-iris/obsws-cli.git
synced 2026-04-18 15:03:44 +00:00
dynamically load commands from obsws_cli.commands
no changes to files other than imports patch bump
This commit is contained in:
47
obsws_cli/commands/virtualcam.py
Normal file
47
obsws_cli/commands/virtualcam.py
Normal file
@@ -0,0 +1,47 @@
|
||||
"""module containing commands for manipulating virtual camera in OBS."""
|
||||
|
||||
import typer
|
||||
|
||||
from obsws_cli import console
|
||||
from obsws_cli.alias import SubTyperAliasGroup
|
||||
|
||||
app = typer.Typer(cls=SubTyperAliasGroup)
|
||||
|
||||
|
||||
@app.callback()
|
||||
def main():
|
||||
"""Control virtual camera in OBS."""
|
||||
|
||||
|
||||
@app.command('start | s')
|
||||
def start(ctx: typer.Context):
|
||||
"""Start the virtual camera."""
|
||||
ctx.obj['obsws'].start_virtual_cam()
|
||||
console.out.print('Virtual camera started.')
|
||||
|
||||
|
||||
@app.command('stop | p')
|
||||
def stop(ctx: typer.Context):
|
||||
"""Stop the virtual camera."""
|
||||
ctx.obj['obsws'].stop_virtual_cam()
|
||||
console.out.print('Virtual camera stopped.')
|
||||
|
||||
|
||||
@app.command('toggle | tg')
|
||||
def toggle(ctx: typer.Context):
|
||||
"""Toggle the virtual camera."""
|
||||
resp = ctx.obj['obsws'].toggle_virtual_cam()
|
||||
if resp.output_active:
|
||||
console.out.print('Virtual camera is enabled.')
|
||||
else:
|
||||
console.out.print('Virtual camera is disabled.')
|
||||
|
||||
|
||||
@app.command('status | ss')
|
||||
def status(ctx: typer.Context):
|
||||
"""Get the status of the virtual camera."""
|
||||
resp = ctx.obj['obsws'].get_virtual_cam_status()
|
||||
if resp.output_active:
|
||||
console.out.print('Virtual camera is enabled.')
|
||||
else:
|
||||
console.out.print('Virtual camera is disabled.')
|
||||
Reference in New Issue
Block a user