mirror of
https://github.com/onyx-and-iris/obsws-cli.git
synced 2026-03-03 16:59:17 +00:00
Compare commits
No commits in common. "f1e29e0d4f649ce1dbbcc68ce93141a6378c0861" and "5c7fc24839b06171c0b604d1af7a07cda8ebedd3" have entirely different histories.
f1e29e0d4f
...
5c7fc24839
@ -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.24.3'
|
__version__ = '0.24.1'
|
||||||
|
|||||||
@ -24,8 +24,6 @@ class RootTyperAliasGroup(typer.core.TyperGroup):
|
|||||||
cmd_name = 'hotkey'
|
cmd_name = 'hotkey'
|
||||||
case 'i':
|
case 'i':
|
||||||
cmd_name = 'input'
|
cmd_name = 'input'
|
||||||
case 'm':
|
|
||||||
cmd_name = 'media'
|
|
||||||
case 'prf':
|
case 'prf':
|
||||||
cmd_name = 'profile'
|
cmd_name = 'profile'
|
||||||
case 'prj':
|
case 'prj':
|
||||||
@ -42,8 +40,6 @@ class RootTyperAliasGroup(typer.core.TyperGroup):
|
|||||||
cmd_name = 'sceneitem'
|
cmd_name = 'sceneitem'
|
||||||
case 'ss':
|
case 'ss':
|
||||||
cmd_name = 'screenshot'
|
cmd_name = 'screenshot'
|
||||||
case 'set':
|
|
||||||
cmd_name = 'settings'
|
|
||||||
case 'st':
|
case 'st':
|
||||||
cmd_name = 'stream'
|
cmd_name = 'stream'
|
||||||
case 'sm':
|
case 'sm':
|
||||||
|
|||||||
@ -23,11 +23,11 @@ for sub_typer in (
|
|||||||
'projector',
|
'projector',
|
||||||
'record',
|
'record',
|
||||||
'replaybuffer',
|
'replaybuffer',
|
||||||
|
'settings',
|
||||||
'scene',
|
'scene',
|
||||||
'scenecollection',
|
'scenecollection',
|
||||||
'sceneitem',
|
'sceneitem',
|
||||||
'screenshot',
|
'screenshot',
|
||||||
'settings',
|
|
||||||
'stream',
|
'stream',
|
||||||
'studiomode',
|
'studiomode',
|
||||||
'text',
|
'text',
|
||||||
|
|||||||
@ -31,7 +31,7 @@ def list_(
|
|||||||
] = None,
|
] = None,
|
||||||
):
|
):
|
||||||
"""List groups in a scene."""
|
"""List groups in a scene."""
|
||||||
if scene_name is None:
|
if not scene_name:
|
||||||
scene_name = ctx.obj['obsws'].get_current_program_scene().scene_name
|
scene_name = ctx.obj['obsws'].get_current_program_scene().scene_name
|
||||||
|
|
||||||
resp = ctx.obj['obsws'].get_scene_item_list(scene_name)
|
resp = ctx.obj['obsws'].get_scene_item_list(scene_name)
|
||||||
|
|||||||
@ -4,7 +4,7 @@ from typing import Annotated, Optional
|
|||||||
|
|
||||||
import typer
|
import typer
|
||||||
|
|
||||||
from . import console, util, validate
|
from . import console, util
|
||||||
from .alias import SubTyperAliasGroup
|
from .alias import SubTyperAliasGroup
|
||||||
|
|
||||||
app = typer.Typer(cls=SubTyperAliasGroup)
|
app = typer.Typer(cls=SubTyperAliasGroup)
|
||||||
@ -24,9 +24,7 @@ def cursor(
|
|||||||
timecode: Annotated[
|
timecode: Annotated[
|
||||||
Optional[str],
|
Optional[str],
|
||||||
typer.Argument(
|
typer.Argument(
|
||||||
...,
|
..., help='The timecode to set the cursor to (format: HH:MM:SS).'
|
||||||
help='The timecode to set the cursor to (format: HH:MM:SS).',
|
|
||||||
callback=validate.timecode_format,
|
|
||||||
),
|
),
|
||||||
] = None,
|
] = None,
|
||||||
):
|
):
|
||||||
|
|||||||
@ -30,7 +30,7 @@ def list_(
|
|||||||
uuid: Annotated[bool, typer.Option(help='Show UUIDs of scene items')] = False,
|
uuid: Annotated[bool, typer.Option(help='Show UUIDs of scene items')] = False,
|
||||||
):
|
):
|
||||||
"""List all items in a scene."""
|
"""List all items in a scene."""
|
||||||
if scene_name is None:
|
if not scene_name:
|
||||||
scene_name = ctx.obj['obsws'].get_current_program_scene().scene_name
|
scene_name = ctx.obj['obsws'].get_current_program_scene().scene_name
|
||||||
|
|
||||||
resp = ctx.obj['obsws'].get_scene_item_list(scene_name)
|
resp = ctx.obj['obsws'].get_scene_item_list(scene_name)
|
||||||
|
|||||||
@ -1,7 +1,5 @@
|
|||||||
"""module containing validation functions."""
|
"""module containing validation functions."""
|
||||||
|
|
||||||
from typing import Optional
|
|
||||||
|
|
||||||
import typer
|
import typer
|
||||||
|
|
||||||
from . import console
|
from . import console
|
||||||
@ -28,11 +26,8 @@ def input_not_in_inputs(ctx: typer.Context, input_name: str) -> bool:
|
|||||||
return input_name
|
return input_name
|
||||||
|
|
||||||
|
|
||||||
def scene_in_scenes(ctx: typer.Context, scene_name: Optional[str]) -> str | None:
|
def scene_in_scenes(ctx: typer.Context, scene_name: str) -> str:
|
||||||
"""Check if a scene exists in the list of scenes."""
|
"""Check if a scene exists in the list of scenes."""
|
||||||
if scene_name is None:
|
|
||||||
return scene_name
|
|
||||||
|
|
||||||
resp = ctx.obj['obsws'].get_scene_list()
|
resp = ctx.obj['obsws'].get_scene_list()
|
||||||
if not any(scene.get('sceneName') == scene_name for scene in resp.scenes):
|
if not any(scene.get('sceneName') == scene_name for scene in resp.scenes):
|
||||||
console.err.print(f'Scene [yellow]{scene_name}[/yellow] not found.')
|
console.err.print(f'Scene [yellow]{scene_name}[/yellow] not found.')
|
||||||
@ -109,29 +104,3 @@ def kind_in_input_kinds(ctx: typer.Context, input_kind: str) -> str:
|
|||||||
console.err.print(f'Input kind [yellow]{input_kind}[/yellow] not found.')
|
console.err.print(f'Input kind [yellow]{input_kind}[/yellow] not found.')
|
||||||
raise typer.Exit(1)
|
raise typer.Exit(1)
|
||||||
return input_kind
|
return input_kind
|
||||||
|
|
||||||
|
|
||||||
def timecode_format(ctx: typer.Context, timecode: Optional[str]) -> str | None:
|
|
||||||
"""Validate that a timecode is in HH:MM:SS or MM:SS format."""
|
|
||||||
if timecode is None:
|
|
||||||
return timecode
|
|
||||||
|
|
||||||
match timecode.split(':'):
|
|
||||||
case [mm, ss]:
|
|
||||||
if not (mm.isdigit() and ss.isdigit()):
|
|
||||||
console.err.print(
|
|
||||||
f'Timecode [yellow]{timecode}[/yellow] is not valid. Use MM:SS or HH:MM:SS format.'
|
|
||||||
)
|
|
||||||
raise typer.Exit(1)
|
|
||||||
case [hh, mm, ss]:
|
|
||||||
if not (hh.isdigit() and mm.isdigit() and ss.isdigit()):
|
|
||||||
console.err.print(
|
|
||||||
f'Timecode [yellow]{timecode}[/yellow] is not valid. Use MM:SS or HH:MM:SS format.'
|
|
||||||
)
|
|
||||||
raise typer.Exit(1)
|
|
||||||
case _:
|
|
||||||
console.err.print(
|
|
||||||
f'Timecode [yellow]{timecode}[/yellow] is not valid. Use MM:SS or HH:MM:SS format.'
|
|
||||||
)
|
|
||||||
raise typer.Exit(1)
|
|
||||||
return timecode
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user