mirror of
https://github.com/onyx-and-iris/obsws-cli.git
synced 2025-08-03 10:31:46 +00:00
convert virtualcam commands
This commit is contained in:
parent
506aff833c
commit
2ef89be184
@ -38,6 +38,7 @@ for sub_app in (
|
||||
'stream',
|
||||
'studiomode',
|
||||
'text',
|
||||
'virtualcam',
|
||||
):
|
||||
module = importlib.import_module(f'.{sub_app}', package=__package__)
|
||||
app.command(module.app)
|
||||
|
@ -1,46 +1,51 @@
|
||||
"""module containing commands for manipulating virtual camera in OBS."""
|
||||
|
||||
import typer
|
||||
from typing import Annotated
|
||||
|
||||
from cyclopts import App, Parameter
|
||||
|
||||
from . import console
|
||||
from .alias import SubTyperAliasGroup
|
||||
from .context import Context
|
||||
|
||||
app = typer.Typer(cls=SubTyperAliasGroup)
|
||||
app = App(name='virtualcam', help='Commands for controlling the virtual camera in OBS.')
|
||||
|
||||
|
||||
@app.callback()
|
||||
def main():
|
||||
"""Control virtual camera in OBS."""
|
||||
|
||||
|
||||
@app.command('start | s')
|
||||
def start(ctx: typer.Context):
|
||||
@app.command(name=['start', 's'])
|
||||
def start(
|
||||
ctx: Annotated[Context, Parameter(parse=False)],
|
||||
):
|
||||
"""Start the virtual camera."""
|
||||
ctx.obj['obsws'].start_virtual_cam()
|
||||
ctx.client.start_virtual_cam()
|
||||
console.out.print('Virtual camera started.')
|
||||
|
||||
|
||||
@app.command('stop | p')
|
||||
def stop(ctx: typer.Context):
|
||||
@app.command(name=['stop', 'p'])
|
||||
def stop(
|
||||
ctx: Annotated[Context, Parameter(parse=False)],
|
||||
):
|
||||
"""Stop the virtual camera."""
|
||||
ctx.obj['obsws'].stop_virtual_cam()
|
||||
ctx.client.stop_virtual_cam()
|
||||
console.out.print('Virtual camera stopped.')
|
||||
|
||||
|
||||
@app.command('toggle | tg')
|
||||
def toggle(ctx: typer.Context):
|
||||
@app.command(name=['toggle', 'tg'])
|
||||
def toggle(
|
||||
ctx: Annotated[Context, Parameter(parse=False)],
|
||||
):
|
||||
"""Toggle the virtual camera."""
|
||||
resp = ctx.obj['obsws'].toggle_virtual_cam()
|
||||
resp = ctx.client.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):
|
||||
@app.command(name=['status', 'ss'])
|
||||
def status(
|
||||
ctx: Annotated[Context, Parameter(parse=False)],
|
||||
):
|
||||
"""Get the status of the virtual camera."""
|
||||
resp = ctx.obj['obsws'].get_virtual_cam_status()
|
||||
resp = ctx.client.get_virtual_cam_status()
|
||||
if resp.output_active:
|
||||
console.out.print('Virtual camera is enabled.')
|
||||
else:
|
||||
|
Loading…
x
Reference in New Issue
Block a user