mirror of
https://github.com/onyx-and-iris/obsws-cli.git
synced 2025-05-16 06:20:23 +01:00
use SettingsConfigDict
add Optional annotations patch bump
This commit is contained in:
parent
4b359cbfc0
commit
fff41e1895
@ -1,4 +1,4 @@
|
||||
# SPDX-FileCopyrightText: 2025-present onyx-and-iris <code@onyxandiris.online>
|
||||
#
|
||||
# SPDX-License-Identifier: MIT
|
||||
__version__ = "0.10.0"
|
||||
__version__ = "0.10.1"
|
||||
|
@ -1,12 +1,11 @@
|
||||
"""Command line interface for the OBS WebSocket API."""
|
||||
|
||||
from pathlib import Path
|
||||
from typing import Annotated
|
||||
from typing import Annotated, Optional
|
||||
|
||||
import obsws_python as obsws
|
||||
import typer
|
||||
from pydantic import ConfigDict
|
||||
from pydantic_settings import BaseSettings
|
||||
from pydantic_settings import BaseSettings, SettingsConfigDict
|
||||
|
||||
from . import (
|
||||
group,
|
||||
@ -27,7 +26,7 @@ from .alias import AliasGroup
|
||||
class Settings(BaseSettings):
|
||||
"""Settings for the OBS WebSocket client."""
|
||||
|
||||
model_config = ConfigDict(
|
||||
model_config = SettingsConfigDict(
|
||||
env_file=(
|
||||
'.env',
|
||||
Path.home() / '.config' / 'obsws-cli' / 'obsws.env',
|
||||
@ -71,10 +70,10 @@ def version(ctx: typer.Context):
|
||||
@app.callback()
|
||||
def main(
|
||||
ctx: typer.Context,
|
||||
host: Annotated[str, typer.Option(help='WebSocket host')] = None,
|
||||
port: Annotated[int, typer.Option(help='WebSocket port')] = None,
|
||||
password: Annotated[str, typer.Option(help='WebSocket password')] = None,
|
||||
timeout: Annotated[int, typer.Option(help='WebSocket timeout')] = None,
|
||||
host: Annotated[Optional[str], typer.Option(help='WebSocket host')] = None,
|
||||
port: Annotated[Optional[int], typer.Option(help='WebSocket port')] = None,
|
||||
password: Annotated[Optional[str], typer.Option(help='WebSocket password')] = None,
|
||||
timeout: Annotated[Optional[int], typer.Option(help='WebSocket timeout')] = None,
|
||||
):
|
||||
"""obsws_cli is a command line interface for the OBS WebSocket API."""
|
||||
settings = Settings()
|
||||
|
@ -1,7 +1,7 @@
|
||||
"""module containing commands for manipulating items in scenes."""
|
||||
|
||||
from collections.abc import Callable
|
||||
from typing import Annotated
|
||||
from typing import Annotated, Optional
|
||||
|
||||
import typer
|
||||
|
||||
@ -34,7 +34,10 @@ def _validate_scene_name_and_item_name(
|
||||
"""Validate the scene name and item name."""
|
||||
|
||||
def wrapper(
|
||||
ctx: typer.Context, scene_name: str, item_name: str, parent: bool = False
|
||||
ctx: typer.Context,
|
||||
scene_name: str,
|
||||
item_name: str,
|
||||
parent: Optional[str] = None,
|
||||
):
|
||||
if not validate.scene_in_scenes(ctx, scene_name):
|
||||
typer.echo(f"Scene '{scene_name}' not found.")
|
||||
@ -57,7 +60,7 @@ def _validate_scene_name_and_item_name(
|
||||
|
||||
|
||||
def _get_scene_name_and_item_id(
|
||||
ctx: typer.Context, scene_name: str, item_name: str, parent: str
|
||||
ctx: typer.Context, scene_name: str, item_name: str, parent: Optional[str] = None
|
||||
):
|
||||
if parent:
|
||||
resp = ctx.obj.get_group_scene_item_list(parent)
|
||||
@ -82,7 +85,7 @@ def show(
|
||||
ctx: typer.Context,
|
||||
scene_name: str,
|
||||
item_name: str,
|
||||
parent: Annotated[str, typer.Option(help='Parent group name')] = None,
|
||||
parent: Annotated[Optional[str], typer.Option(help='Parent group name')] = None,
|
||||
):
|
||||
"""Show an item in a scene."""
|
||||
scene_name, scene_item_id = _get_scene_name_and_item_id(
|
||||
@ -104,7 +107,7 @@ def hide(
|
||||
ctx: typer.Context,
|
||||
scene_name: str,
|
||||
item_name: str,
|
||||
parent: Annotated[str, typer.Option(help='Parent group name')] = None,
|
||||
parent: Annotated[Optional[str], typer.Option(help='Parent group name')] = None,
|
||||
):
|
||||
"""Hide an item in a scene."""
|
||||
scene_name, scene_item_id = _get_scene_name_and_item_id(
|
||||
@ -126,7 +129,7 @@ def toggle(
|
||||
ctx: typer.Context,
|
||||
scene_name: str,
|
||||
item_name: str,
|
||||
parent: Annotated[str, typer.Option(help='Parent group name')] = None,
|
||||
parent: Annotated[Optional[str], typer.Option(help='Parent group name')] = None,
|
||||
):
|
||||
"""Toggle an item in a scene."""
|
||||
if not validate.scene_in_scenes(ctx, scene_name):
|
||||
@ -169,7 +172,7 @@ def visible(
|
||||
ctx: typer.Context,
|
||||
scene_name: str,
|
||||
item_name: str,
|
||||
parent: Annotated[str, typer.Option(help='Parent group name')] = None,
|
||||
parent: Annotated[Optional[str], typer.Option(help='Parent group name')] = None,
|
||||
):
|
||||
"""Check if an item in a scene is visible."""
|
||||
if parent:
|
||||
@ -211,51 +214,51 @@ def transform(
|
||||
ctx: typer.Context,
|
||||
scene_name: str,
|
||||
item_name: str,
|
||||
parent: Annotated[str, typer.Option(help='Parent group name')] = None,
|
||||
parent: Annotated[Optional[str], typer.Option(help='Parent group name')] = None,
|
||||
alignment: Annotated[
|
||||
int, typer.Option(help='Alignment of the item in the scene')
|
||||
Optional[int], typer.Option(help='Alignment of the item in the scene')
|
||||
] = None,
|
||||
bounds_alignment: Annotated[
|
||||
int, typer.Option(help='Bounds alignment of the item in the scene')
|
||||
Optional[int], typer.Option(help='Bounds alignment of the item in the scene')
|
||||
] = None,
|
||||
bounds_height: Annotated[
|
||||
float, typer.Option(help='Height of the item in the scene')
|
||||
Optional[float], typer.Option(help='Height of the item in the scene')
|
||||
] = None,
|
||||
bounds_type: Annotated[
|
||||
str, typer.Option(help='Type of bounds for the item in the scene')
|
||||
Optional[str], typer.Option(help='Type of bounds for the item in the scene')
|
||||
] = None,
|
||||
bounds_width: Annotated[
|
||||
float, typer.Option(help='Width of the item in the scene')
|
||||
Optional[float], typer.Option(help='Width of the item in the scene')
|
||||
] = None,
|
||||
crop_to_bounds: Annotated[
|
||||
bool, typer.Option(help='Crop the item to the bounds')
|
||||
Optional[bool], typer.Option(help='Crop the item to the bounds')
|
||||
] = None,
|
||||
crop_bottom: Annotated[
|
||||
float, typer.Option(help='Bottom crop of the item in the scene')
|
||||
Optional[float], typer.Option(help='Bottom crop of the item in the scene')
|
||||
] = None,
|
||||
crop_left: Annotated[
|
||||
float, typer.Option(help='Left crop of the item in the scene')
|
||||
Optional[float], typer.Option(help='Left crop of the item in the scene')
|
||||
] = None,
|
||||
crop_right: Annotated[
|
||||
float, typer.Option(help='Right crop of the item in the scene')
|
||||
Optional[float], typer.Option(help='Right crop of the item in the scene')
|
||||
] = None,
|
||||
crop_top: Annotated[
|
||||
float, typer.Option(help='Top crop of the item in the scene')
|
||||
Optional[float], typer.Option(help='Top crop of the item in the scene')
|
||||
] = None,
|
||||
position_x: Annotated[
|
||||
float, typer.Option(help='X position of the item in the scene')
|
||||
Optional[float], typer.Option(help='X position of the item in the scene')
|
||||
] = None,
|
||||
position_y: Annotated[
|
||||
float, typer.Option(help='Y position of the item in the scene')
|
||||
Optional[float], typer.Option(help='Y position of the item in the scene')
|
||||
] = None,
|
||||
rotation: Annotated[
|
||||
float, typer.Option(help='Rotation of the item in the scene')
|
||||
Optional[float], typer.Option(help='Rotation of the item in the scene')
|
||||
] = None,
|
||||
scale_x: Annotated[
|
||||
float, typer.Option(help='X scale of the item in the scene')
|
||||
Optional[float], typer.Option(help='X scale of the item in the scene')
|
||||
] = None,
|
||||
scale_y: Annotated[
|
||||
float, typer.Option(help='Y scale of the item in the scene')
|
||||
Optional[float], typer.Option(help='Y scale of the item in the scene')
|
||||
] = None,
|
||||
):
|
||||
"""Set the transform of an item in a scene."""
|
||||
|
Loading…
x
Reference in New Issue
Block a user