mirror of
https://github.com/onyx-and-iris/obsws-cli.git
synced 2025-06-07 20:20:32 +01:00
add projector subtyper
This commit is contained in:
parent
b5364bfedc
commit
2739fa28f0
@ -12,6 +12,7 @@ from . import (
|
|||||||
hotkey,
|
hotkey,
|
||||||
input,
|
input,
|
||||||
profile,
|
profile,
|
||||||
|
projector,
|
||||||
record,
|
record,
|
||||||
replaybuffer,
|
replaybuffer,
|
||||||
scene,
|
scene,
|
||||||
@ -30,6 +31,7 @@ for module in (
|
|||||||
group,
|
group,
|
||||||
hotkey,
|
hotkey,
|
||||||
input,
|
input,
|
||||||
|
projector,
|
||||||
profile,
|
profile,
|
||||||
record,
|
record,
|
||||||
replaybuffer,
|
replaybuffer,
|
||||||
|
58
obsws_cli/projector.py
Normal file
58
obsws_cli/projector.py
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
"""module containing commands for manipulating projectors in OBS."""
|
||||||
|
|
||||||
|
from typing import Annotated
|
||||||
|
|
||||||
|
import typer
|
||||||
|
from rich.console import Console
|
||||||
|
from rich.table import Table
|
||||||
|
|
||||||
|
from .alias import AliasGroup
|
||||||
|
|
||||||
|
app = typer.Typer(cls=AliasGroup)
|
||||||
|
out_console = Console()
|
||||||
|
err_console = Console(stderr=True)
|
||||||
|
|
||||||
|
|
||||||
|
@app.callback()
|
||||||
|
def main():
|
||||||
|
"""Control projectors in OBS."""
|
||||||
|
|
||||||
|
|
||||||
|
@app.command('list-monitors | ls-m')
|
||||||
|
def list_monitors(ctx: typer.Context):
|
||||||
|
"""List available monitors."""
|
||||||
|
resp = ctx.obj.get_monitor_list()
|
||||||
|
|
||||||
|
if not resp.monitors:
|
||||||
|
out_console.print('No monitors found.')
|
||||||
|
return
|
||||||
|
|
||||||
|
monitors = sorted(
|
||||||
|
((m['monitorIndex'], m['monitorName']) for m in resp.monitors),
|
||||||
|
key=lambda m: m[0],
|
||||||
|
)
|
||||||
|
|
||||||
|
table = Table(title='Available Monitors', padding=(0, 2))
|
||||||
|
table.add_column('Index', justify='right', style='cyan')
|
||||||
|
table.add_column('Name', style='cyan')
|
||||||
|
|
||||||
|
for index, monitor in monitors:
|
||||||
|
table.add_row(str(index), monitor)
|
||||||
|
|
||||||
|
out_console.print(table)
|
||||||
|
|
||||||
|
|
||||||
|
@app.command('open | o')
|
||||||
|
def open(
|
||||||
|
ctx: typer.Context,
|
||||||
|
source_name: str,
|
||||||
|
monitor_index: Annotated[
|
||||||
|
int,
|
||||||
|
typer.Option(help='Index of the monitor to open the projector on.'),
|
||||||
|
] = 0,
|
||||||
|
):
|
||||||
|
"""Open a fullscreen projector for a source on a specific monitor."""
|
||||||
|
ctx.obj.open_source_projector(
|
||||||
|
source_name=source_name,
|
||||||
|
monitor_index=monitor_index,
|
||||||
|
)
|
Loading…
x
Reference in New Issue
Block a user