keep it consistent

This commit is contained in:
onyx-and-iris 2025-05-19 14:41:42 +01:00
parent 1dd6992129
commit b186685e2f
7 changed files with 35 additions and 35 deletions

View File

@ -19,7 +19,7 @@ def list(ctx: typer.Context, scene_name: str):
"""List groups in a scene."""
if not validate.scene_in_scenes(ctx, scene_name):
typer.echo(f"Scene '{scene_name}' not found.", err=True)
raise typer.Exit(code=1)
raise typer.Exit(1)
resp = ctx.obj.get_scene_item_list(scene_name)
groups = (
@ -46,12 +46,12 @@ def show(ctx: typer.Context, scene_name: str, group_name: str):
"""Show a group in a scene."""
if not validate.scene_in_scenes(ctx, scene_name):
typer.echo(f"Scene '{scene_name}' not found.", err=True)
raise typer.Exit(code=1)
raise typer.Exit(1)
resp = ctx.obj.get_scene_item_list(scene_name)
if (group := _get_group(group_name, resp)) is None:
typer.echo(f"Group '{group_name}' not found in scene {scene_name}.", err=True)
raise typer.Exit(code=1)
raise typer.Exit(1)
ctx.obj.set_scene_item_enabled(
scene_name=scene_name,
@ -67,12 +67,12 @@ def hide(ctx: typer.Context, scene_name: str, group_name: str):
"""Hide a group in a scene."""
if not validate.scene_in_scenes(ctx, scene_name):
typer.echo(f"Scene '{scene_name}' not found.", err=True)
raise typer.Exit(code=1)
raise typer.Exit(1)
resp = ctx.obj.get_scene_item_list(scene_name)
if (group := _get_group(group_name, resp)) is None:
typer.echo(f"Group '{group_name}' not found in scene {scene_name}.", err=True)
raise typer.Exit(code=1)
raise typer.Exit(1)
ctx.obj.set_scene_item_enabled(
scene_name=scene_name,
@ -88,12 +88,12 @@ def toggle(ctx: typer.Context, scene_name: str, group_name: str):
"""Toggle a group in a scene."""
if not validate.scene_in_scenes(ctx, scene_name):
typer.echo(f"Scene '{scene_name}' not found.", err=True)
raise typer.Exit(code=1)
raise typer.Exit(1)
resp = ctx.obj.get_scene_item_list(scene_name)
if (group := _get_group(group_name, resp)) is None:
typer.echo(f"Group '{group_name}' not found in scene {scene_name}.", err=True)
raise typer.Exit(code=1)
raise typer.Exit(1)
new_state = not group.get('sceneItemEnabled')
ctx.obj.set_scene_item_enabled(
@ -113,12 +113,12 @@ def status(ctx: typer.Context, scene_name: str, group_name: str):
"""Get the status of a group in a scene."""
if not validate.scene_in_scenes(ctx, scene_name):
typer.echo(f"Scene '{scene_name}' not found.", err=True)
raise typer.Exit(code=1)
raise typer.Exit(1)
resp = ctx.obj.get_scene_item_list(scene_name)
if (group := _get_group(group_name, resp)) is None:
typer.echo(f"Group '{group_name}' not found in scene {scene_name}.", err=True)
raise typer.Exit(code=1)
raise typer.Exit(1)
enabled = ctx.obj.get_scene_item_enabled(
scene_name=scene_name,

View File

@ -47,7 +47,7 @@ def mute(ctx: typer.Context, input_name: str):
"""Mute an input."""
if not validate.input_in_inputs(ctx, input_name):
typer.echo(f"Input '{input_name}' not found.", err=True)
raise typer.Exit(code=1)
raise typer.Exit(1)
ctx.obj.set_input_mute(
name=input_name,
@ -62,7 +62,7 @@ def unmute(ctx: typer.Context, input_name: str):
"""Unmute an input."""
if not validate.input_in_inputs(ctx, input_name):
typer.echo(f"Input '{input_name}' not found.", err=True)
raise typer.Exit(code=1)
raise typer.Exit(1)
ctx.obj.set_input_mute(
name=input_name,
@ -77,7 +77,7 @@ def toggle(ctx: typer.Context, input_name: str):
"""Toggle an input."""
if not validate.input_in_inputs(ctx, input_name):
typer.echo(f"Input '{input_name}' not found.", err=True)
raise typer.Exit(code=1)
raise typer.Exit(1)
# Get the current mute state
resp = ctx.obj.get_input_mute(name=input_name)

View File

@ -33,14 +33,14 @@ def switch(ctx: typer.Context, profile_name: str):
"""Switch to a profile."""
if not validate.profile_exists(ctx, profile_name):
typer.echo(f"Profile '{profile_name}' not found.", err=True)
raise typer.Exit(code=1)
raise typer.Exit(1)
resp = ctx.obj.get_profile_list()
if resp.current_profile_name == profile_name:
typer.echo(
f"Profile '{profile_name}' is already the current profile.", err=True
)
raise typer.Exit(code=1)
raise typer.Exit(1)
ctx.obj.set_current_profile(profile_name)
typer.echo(f"Switched to profile '{profile_name}'.")
@ -51,7 +51,7 @@ def create(ctx: typer.Context, profile_name: str):
"""Create a new profile."""
if validate.profile_exists(ctx, profile_name):
typer.echo(f"Profile '{profile_name}' already exists.", err=True)
raise typer.Exit(code=1)
raise typer.Exit(1)
ctx.obj.create_profile(profile_name)
typer.echo(f"Created profile '{profile_name}'.")
@ -62,7 +62,7 @@ def remove(ctx: typer.Context, profile_name: str):
"""Remove a profile."""
if not validate.profile_exists(ctx, profile_name):
typer.echo(f"Profile '{profile_name}' not found.", err=True)
raise typer.Exit(code=1)
raise typer.Exit(1)
ctx.obj.remove_profile(profile_name)
typer.echo(f"Removed profile '{profile_name}'.")

View File

@ -61,7 +61,7 @@ def switch(
if not validate.scene_in_scenes(ctx, scene_name):
typer.echo(f"Scene '{scene_name}' not found.", err=True)
raise typer.Exit(code=1)
raise typer.Exit(1)
if preview:
ctx.obj.set_current_preview_scene(scene_name)

View File

@ -32,7 +32,7 @@ def switch(ctx: typer.Context, scene_collection_name: str):
"""Switch to a scene collection."""
if not validate.scene_collection_in_scene_collections(ctx, scene_collection_name):
typer.echo(f"Scene collection '{scene_collection_name}' not found.", err=True)
raise typer.Exit(code=1)
raise typer.Exit(1)
current_scene_collection = (
ctx.obj.get_scene_collection_list().current_scene_collection_name
@ -41,7 +41,7 @@ def switch(ctx: typer.Context, scene_collection_name: str):
typer.echo(
f'Scene collection "{scene_collection_name}" is already active.', err=True
)
raise typer.Exit(code=1)
raise typer.Exit(1)
ctx.obj.set_current_scene_collection(scene_collection_name)
typer.echo(f"Switched to scene collection '{scene_collection_name}'")
@ -54,7 +54,7 @@ def create(ctx: typer.Context, scene_collection_name: str):
typer.echo(
f"Scene collection '{scene_collection_name}' already exists.", err=True
)
raise typer.Exit(code=1)
raise typer.Exit(1)
ctx.obj.create_scene_collection(scene_collection_name)
typer.echo(f'Created scene collection {scene_collection_name}')

View File

@ -21,7 +21,7 @@ def list(ctx: typer.Context, scene_name: str):
"""List all items in a scene."""
if not validate.scene_in_scenes(ctx, scene_name):
typer.echo(f"Scene '{scene_name}' not found.", err=True)
typer.Exit(code=1)
typer.Exit(1)
resp = ctx.obj.get_scene_item_list(scene_name)
items = (item.get('sourceName') for item in resp.scene_items)
@ -41,7 +41,7 @@ def _validate_scene_name_and_item_name(
):
if not validate.scene_in_scenes(ctx, scene_name):
typer.echo(f"Scene '{scene_name}' not found.", err=True)
raise typer.Exit(code=1)
raise typer.Exit(1)
if parent:
if not validate.item_in_scene_item_list(ctx, scene_name, parent):
@ -49,13 +49,13 @@ def _validate_scene_name_and_item_name(
f"Parent group '{parent}' not found in scene '{scene_name}'.",
err=True,
)
raise typer.Exit(code=1)
raise typer.Exit(1)
else:
if not validate.item_in_scene_item_list(ctx, scene_name, item_name):
typer.echo(
f"Item '{item_name}' not found in scene '{scene_name}'.", err=True
)
raise typer.Exit(code=1)
raise typer.Exit(1)
return func(ctx, scene_name, item_name, parent)
@ -74,7 +74,7 @@ def _get_scene_name_and_item_id(
break
else:
typer.echo(f"Item '{item_name}' not found in group '{parent}'.", err=True)
raise typer.Exit(code=1)
raise typer.Exit(1)
else:
resp = ctx.obj.get_scene_item_id(scene_name, item_name)
scene_item_id = resp.scene_item_id
@ -137,20 +137,20 @@ def toggle(
"""Toggle an item in a scene."""
if not validate.scene_in_scenes(ctx, scene_name):
typer.echo(f"Scene '{scene_name}' not found.")
raise typer.Exit(code=1)
raise typer.Exit(1)
if parent:
if not validate.item_in_scene_item_list(ctx, scene_name, parent):
typer.echo(
f"Parent group '{parent}' not found in scene '{scene_name}'.", err=True
)
raise typer.Exit(code=1)
raise typer.Exit(1)
else:
if not validate.item_in_scene_item_list(ctx, scene_name, item_name):
typer.echo(
f"Item '{item_name}' not found in scene '{scene_name}'.", err=True
)
raise typer.Exit(code=1)
raise typer.Exit(1)
scene_name, scene_item_id = _get_scene_name_and_item_id(
ctx, scene_name, item_name, parent
@ -187,13 +187,13 @@ def visible(
typer.echo(
f"Parent group '{parent}' not found in scene '{scene_name}'.", err=True
)
raise typer.Exit(code=1)
raise typer.Exit(1)
else:
if not validate.item_in_scene_item_list(ctx, scene_name, item_name):
typer.echo(
f"Item '{item_name}' not found in scene '{scene_name}'.", err=True
)
raise typer.Exit(code=1)
raise typer.Exit(1)
old_scene_name = scene_name
scene_name, scene_item_id = _get_scene_name_and_item_id(
@ -278,13 +278,13 @@ def transform(
typer.echo(
f"Parent group '{parent}' not found in scene '{scene_name}'.", err=True
)
raise typer.Exit(code=1)
raise typer.Exit(1)
else:
if not validate.item_in_scene_item_list(ctx, scene_name, item_name):
typer.echo(
f"Item '{item_name}' not found in scene '{scene_name}'.", err=True
)
raise typer.Exit(code=1)
raise typer.Exit(1)
old_scene_name = scene_name
scene_name, scene_item_id = _get_scene_name_and_item_id(
@ -325,7 +325,7 @@ def transform(
if not transform:
typer.echo('No transform options provided.', err=True)
raise typer.Exit(code=1)
raise typer.Exit(1)
transform = ctx.obj.set_scene_item_transform(
scene_name=scene_name,

View File

@ -24,7 +24,7 @@ def start(ctx: typer.Context):
active, _ = _get_streaming_status(ctx)
if active:
typer.echo('Streaming is already in progress, cannot start.', err=True)
raise typer.Exit(code=1)
raise typer.Exit(1)
ctx.obj.start_stream()
typer.echo('Streaming started successfully.')
@ -36,7 +36,7 @@ def stop(ctx: typer.Context):
active, _ = _get_streaming_status(ctx)
if not active:
typer.echo('Streaming is not in progress, cannot stop.', err=True)
raise typer.Exit(code=1)
raise typer.Exit(1)
ctx.obj.stop_stream()
typer.echo('Streaming stopped successfully.')