mirror of
https://github.com/onyx-and-iris/obsws-cli.git
synced 2025-08-05 11:31:44 +00:00
59 lines
1.5 KiB
Python
59 lines
1.5 KiB
Python
"""module containing commands for manipulating studio mode in OBS."""
|
|
|
|
from typing import Annotated
|
|
|
|
from cyclopts import App, Parameter
|
|
|
|
from . import console
|
|
from .context import Context
|
|
|
|
app = App(name='studiomode', help='Commands for controlling studio mode in OBS.')
|
|
|
|
|
|
@app.command(name=['enable', 'on'])
|
|
def enable(
|
|
*,
|
|
ctx: Annotated[Context, Parameter(parse=False)],
|
|
):
|
|
"""Enable studio mode."""
|
|
ctx.obj['obsws'].set_studio_mode_enabled(True)
|
|
console.out.print('Studio mode has been enabled.')
|
|
|
|
|
|
@app.command(name=['disable', 'off'])
|
|
def disable(
|
|
*,
|
|
ctx: Annotated[Context, Parameter(parse=False)],
|
|
):
|
|
"""Disable studio mode."""
|
|
ctx.client.set_studio_mode_enabled(False)
|
|
console.out.print('Studio mode has been disabled.')
|
|
|
|
|
|
@app.command(name=['toggle', 'tg'])
|
|
def toggle(
|
|
*,
|
|
ctx: Annotated[Context, Parameter(parse=False)],
|
|
):
|
|
"""Toggle studio mode."""
|
|
resp = ctx.client.get_studio_mode_enabled()
|
|
if resp.studio_mode_enabled:
|
|
ctx.client.set_studio_mode_enabled(False)
|
|
console.out.print('Studio mode is now disabled.')
|
|
else:
|
|
ctx.client.set_studio_mode_enabled(True)
|
|
console.out.print('Studio mode is now enabled.')
|
|
|
|
|
|
@app.command(name=['status', 'ss'])
|
|
def status(
|
|
*,
|
|
ctx: Annotated[Context, Parameter(parse=False)],
|
|
):
|
|
"""Get the status of studio mode."""
|
|
resp = ctx.client.get_studio_mode_enabled()
|
|
if resp.studio_mode_enabled:
|
|
console.out.print('Studio mode is enabled.')
|
|
else:
|
|
console.out.print('Studio mode is disabled.')
|