mirror of
https://github.com/onyx-and-iris/obsws-cli.git
synced 2025-06-07 20:20:32 +01:00
add --parent flag to scene-item visible
upd readme patch bump
This commit is contained in:
parent
0267c2ec78
commit
ae52e754d2
@ -127,14 +127,18 @@ obsws-cli scene-item hide START "Colour Source"
|
|||||||
- args: <scene_name> <item_name>
|
- args: <scene_name> <item_name>
|
||||||
|
|
||||||
```console
|
```console
|
||||||
obsws-cli scene-item toggle --parent=test_group START "Colour Source 4"
|
obsws-cli scene-item toggle --parent=test_group START "Colour Source 3"
|
||||||
```
|
```
|
||||||
|
|
||||||
- visible: Check if an item in a scene is visible.
|
- visible: Check if an item in a scene is visible.
|
||||||
|
- flags:
|
||||||
|
|
||||||
|
*optional*
|
||||||
|
- --parent: Parent group name
|
||||||
- args: <scene_name> <item_name>
|
- args: <scene_name> <item_name>
|
||||||
|
|
||||||
```console
|
```console
|
||||||
obsws-cli scene-item visible START "Colour Source"
|
obsws-cli scene-item visible --parent=test_group START "Colour Source 4"
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Scene Collections
|
#### Scene Collections
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
# SPDX-FileCopyrightText: 2025-present onyx-and-iris <code@onyxandiris.online>
|
# SPDX-FileCopyrightText: 2025-present onyx-and-iris <code@onyxandiris.online>
|
||||||
#
|
#
|
||||||
# SPDX-License-Identifier: MIT
|
# SPDX-License-Identifier: MIT
|
||||||
__version__ = "0.6.4"
|
__version__ = "0.6.5"
|
||||||
|
@ -150,21 +150,41 @@ def toggle(
|
|||||||
|
|
||||||
|
|
||||||
@app.command()
|
@app.command()
|
||||||
def visible(ctx: typer.Context, scene_name: str, item_name: str):
|
def visible(
|
||||||
|
ctx: typer.Context,
|
||||||
|
scene_name: str,
|
||||||
|
item_name: str,
|
||||||
|
parent: Annotated[str, typer.Option(help='Parent group name')] = None,
|
||||||
|
):
|
||||||
"""Check if an item in a scene is visible."""
|
"""Check if an item in a scene is visible."""
|
||||||
if not validate.scene_in_scenes(ctx, scene_name):
|
if parent:
|
||||||
typer.echo(f"Scene '{scene_name}' not found.")
|
if not validate.item_in_scene_item_list(ctx, scene_name, parent):
|
||||||
raise typer.Exit(code=1)
|
typer.echo(f"Parent group '{parent}' not found in scene '{scene_name}'.")
|
||||||
|
raise typer.Exit(code=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}'.")
|
||||||
|
raise typer.Exit(code=1)
|
||||||
|
|
||||||
if not validate.item_in_scene_item_list(ctx, scene_name, item_name):
|
old_scene_name = scene_name
|
||||||
typer.echo(f"Item '{item_name}' not found in scene '{scene_name}'.")
|
scene_name, scene_item_id = _get_scene_name_and_item_id(
|
||||||
raise typer.Exit(code=1)
|
ctx, scene_name, item_name, parent
|
||||||
|
)
|
||||||
|
|
||||||
resp = ctx.obj['obsws'].get_scene_item_id(scene_name, item_name)
|
|
||||||
enabled = ctx.obj['obsws'].get_scene_item_enabled(
|
enabled = ctx.obj['obsws'].get_scene_item_enabled(
|
||||||
scene_name=scene_name,
|
scene_name=scene_name,
|
||||||
item_id=int(resp.scene_item_id),
|
item_id=int(scene_item_id),
|
||||||
)
|
|
||||||
typer.echo(
|
|
||||||
f"Item '{item_name}' in scene '{scene_name}' is currently {'visible' if enabled.scene_item_enabled else 'hidden'}."
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if parent:
|
||||||
|
typer.echo(
|
||||||
|
f"Item '{item_name}' in group '{parent}' in scene '{old_scene_name}' is currently {'visible' if enabled.scene_item_enabled else 'hidden'}."
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
# If not in a parent group, just show the scene name
|
||||||
|
# This is to avoid confusion with the parent group name
|
||||||
|
# which is not the same as the scene name
|
||||||
|
# and is not needed in this case
|
||||||
|
typer.echo(
|
||||||
|
f"Item '{item_name}' in scene '{scene_name}' is currently {'visible' if enabled.scene_item_enabled else 'hidden'}."
|
||||||
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user