mirror of
https://github.com/onyx-and-iris/obsws-cli.git
synced 2025-06-07 20:20:32 +01:00
update root typer with new subtypers
add profile_exists() to validate
This commit is contained in:
parent
e270e94756
commit
be949ca7bf
@ -8,7 +8,18 @@ import typer
|
|||||||
from pydantic import ConfigDict
|
from pydantic import ConfigDict
|
||||||
from pydantic_settings import BaseSettings
|
from pydantic_settings import BaseSettings
|
||||||
|
|
||||||
from . import group, input, record, scene, scenecollection, sceneitem, stream
|
from . import (
|
||||||
|
group,
|
||||||
|
input,
|
||||||
|
profile,
|
||||||
|
record,
|
||||||
|
replaybuffer,
|
||||||
|
scene,
|
||||||
|
scenecollection,
|
||||||
|
sceneitem,
|
||||||
|
studiomode,
|
||||||
|
virtualcam,
|
||||||
|
)
|
||||||
from .alias import AliasGroup
|
from .alias import AliasGroup
|
||||||
|
|
||||||
|
|
||||||
@ -31,13 +42,19 @@ class Settings(BaseSettings):
|
|||||||
|
|
||||||
|
|
||||||
app = typer.Typer(cls=AliasGroup)
|
app = typer.Typer(cls=AliasGroup)
|
||||||
app.add_typer(scene.app, name='scene')
|
for module in (
|
||||||
app.add_typer(sceneitem.app, name='scene-item')
|
group,
|
||||||
app.add_typer(group.app, name='group')
|
input,
|
||||||
app.add_typer(input.app, name='input')
|
profile,
|
||||||
app.add_typer(record.app, name='record')
|
record,
|
||||||
app.add_typer(stream.app, name='stream')
|
replaybuffer,
|
||||||
app.add_typer(scenecollection.app, name='scene-collection')
|
scene,
|
||||||
|
scenecollection,
|
||||||
|
sceneitem,
|
||||||
|
studiomode,
|
||||||
|
virtualcam,
|
||||||
|
):
|
||||||
|
app.add_typer(module.app, name=module.__name__.split('.')[-1])
|
||||||
|
|
||||||
|
|
||||||
@app.command()
|
@app.command()
|
||||||
|
@ -40,3 +40,9 @@ def item_in_scene_item_list(
|
|||||||
"""Check if an item exists in a scene."""
|
"""Check if an item exists in a scene."""
|
||||||
resp = ctx.obj.get_scene_item_list(scene_name)
|
resp = ctx.obj.get_scene_item_list(scene_name)
|
||||||
return any(item.get('sourceName') == item_name for item in resp.scene_items)
|
return any(item.get('sourceName') == item_name for item in resp.scene_items)
|
||||||
|
|
||||||
|
|
||||||
|
def profile_exists(ctx: typer.Context, profile_name: str) -> bool:
|
||||||
|
"""Check if a profile exists."""
|
||||||
|
resp = ctx.obj.get_profile_list()
|
||||||
|
return any(profile == profile_name for profile in resp.profiles)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user