mirror of
https://github.com/onyx-and-iris/slobs-cli.git
synced 2026-04-20 16:03:39 +00:00
Compare commits
62 Commits
e4353d7626
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| aaadcc9d38 | |||
| cab4299b17 | |||
| 58a8b96603 | |||
| 8646c7601f | |||
| 2c4a0f618c | |||
| fa681a7208 | |||
| c6c8522a2d | |||
| cac7c09fa6 | |||
| f9f118dc2d | |||
| 835a05dd3e | |||
| 4cd420dc44 | |||
| 06c9fa236d | |||
| 6490b5aa54 | |||
| f7345155f1 | |||
| 1c2d1abb2a | |||
| fe3a975ba3 | |||
| d8622ab037 | |||
| 10cb9777fa | |||
| c48f7a49ac | |||
| b14d9b7610 | |||
| 864751ecc9 | |||
| c02ffac403 | |||
| 6bcdd8391c | |||
| b0d311dad9 | |||
| 46159a0ca4 | |||
| 23d3118e6a | |||
| c369f4e3d5 | |||
| 129c3f57f2 | |||
| 42519ba294 | |||
| 09a44b2dea | |||
| f4421b3351 | |||
| f282f86e72 | |||
| 81d0072148 | |||
| f3c94d1dee | |||
| 3c09f9fd5b | |||
| 51d49c9c93 | |||
| bc43c8483a | |||
| 57e31a7e49 | |||
| db6a9b5e84 | |||
| 03f1dac8ea | |||
| 535b22bf8e | |||
| 6e95e4d670 | |||
| 519db1b46e | |||
| 582587bed5 | |||
| fecd13d345 | |||
| a1a22d0d00 | |||
| 2a18b94b11 | |||
| 409aa2333f | |||
| 80da58bd6f | |||
| 0c5bbc114f | |||
| 564f4116d1 | |||
| 48201e4bbb | |||
| 00273ff461 | |||
| d33c209d7c | |||
| a8bed0f4d9 | |||
| 51923dc8a8 | |||
| 37364e7243 | |||
| 377a9df824 | |||
| e7a561c7b4 | |||
| cb0a87df68 | |||
| ed08d7eff2 | |||
| 4ab2706475 |
26
.github/workflows/publish.yml
vendored
Normal file
26
.github/workflows/publish.yml
vendored
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
name: Publish to PyPI
|
||||||
|
|
||||||
|
on:
|
||||||
|
release:
|
||||||
|
types: [published]
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- 'v*.*.*'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
pypi-publish:
|
||||||
|
name: upload release to PyPI
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
environment: pypi
|
||||||
|
permissions:
|
||||||
|
# This permission is needed for private repositories.
|
||||||
|
contents: read
|
||||||
|
# IMPORTANT: this permission is mandatory for trusted publishing
|
||||||
|
id-token: write
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- uses: pdm-project/setup-pdm@v4
|
||||||
|
|
||||||
|
- name: Publish package distributions to PyPI
|
||||||
|
run: pdm publish
|
||||||
19
.github/workflows/ruff.yml
vendored
Normal file
19
.github/workflows/ruff.yml
vendored
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
name: Ruff
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [main]
|
||||||
|
|
||||||
|
pull_request:
|
||||||
|
branches: [main]
|
||||||
|
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
ruff:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- uses: astral-sh/ruff-action@v3
|
||||||
|
with:
|
||||||
|
args: 'format --check --diff'
|
||||||
7
.pre-commit-config.yaml
Normal file
7
.pre-commit-config.yaml
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
repos:
|
||||||
|
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||||
|
rev: v2.3.0
|
||||||
|
hooks:
|
||||||
|
- id: check-yaml
|
||||||
|
- id: end-of-file-fixer
|
||||||
|
- id: trailing-whitespace
|
||||||
51
CHANGELOG.md
51
CHANGELOG.md
@@ -5,6 +5,57 @@ All notable changes to this project will be documented in this file.
|
|||||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
|
# [0.11.0] - 2025-06-22
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- Various colouring styles, see [Style](https://github.com/onyx-and-iris/slobs-cli/tree/main?tab=readme-ov-file#style)
|
||||||
|
- colouring is applied to list tables as well as highlighted information in stdout/stderr output.
|
||||||
|
- table border styling may be optionally disabled with the --no-border flag.
|
||||||
|
|
||||||
|
# [0.10.0] - 2025-06-13
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- scene commands are prone to raise ProtocolErrors if called too quickly in succession. To make these errors a little more user friendly the following changes have been made:
|
||||||
|
- They print error messages to stderr
|
||||||
|
- They return exit code 2
|
||||||
|
|
||||||
|
# [0.9.0] - 2025-06-12
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- scenecollection command group, see [Scene Collection](https://github.com/onyx-and-iris/slobs-cli/tree/main?tab=readme-ov-file#scene-collection)
|
||||||
|
- add audio status commmand.
|
||||||
|
|
||||||
|
# [0.8.4] - 2025-06-12
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- custom error class SlobsCliError.
|
||||||
|
- scene switch command: if the --preview flag is not passed and we're in studio mode then write a message to the user to indicate the transition is being forced.
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- scene list now shows which scene is the current active scene.
|
||||||
|
- audio list now shows mute states.
|
||||||
|
- scene list and audio list commands now print as tables
|
||||||
|
- --id option added to scene and audio commands to show the source ID in the output
|
||||||
|
- by default this is no longer displayed
|
||||||
|
|
||||||
|
- erroneous paths now print error messages and return 1 instead of raising exceptions.
|
||||||
|
- unit tests updated to reflect the changes.
|
||||||
|
|
||||||
|
# [0.7.6] - 2025-06-11
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- --version/-v command.
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- --token/-t is now required.
|
||||||
|
|
||||||
# [0.7.3] - 2025-06-10
|
# [0.7.3] - 2025-06-10
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|||||||
21
LICENSE
Normal file
21
LICENSE
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2025 Onyx and Iris
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
169
README.md
169
README.md
@@ -14,14 +14,16 @@ For an outline of past/future changes refer to: [CHANGELOG](CHANGELOG.md)
|
|||||||
|
|
||||||
- [Installation](#installation)
|
- [Installation](#installation)
|
||||||
- [Configuration](#configuration)
|
- [Configuration](#configuration)
|
||||||
- [Commands](#root-typer)
|
- [Style](#style)
|
||||||
|
- [Commands](#commands)
|
||||||
|
- [Shell Completion](#shell-completion)
|
||||||
- [License](#license)
|
- [License](#license)
|
||||||
|
|
||||||
## Requirements
|
## Requirements
|
||||||
|
|
||||||
- Python 3.10 or greater
|
- Python 3.11 or greater
|
||||||
- [Streamlabs Desktop][sl-desktop]
|
- [Streamlabs Desktop][sl-desktop]
|
||||||
- A websocket token: Settings > Remote Control > API Token
|
- A websocket token: Settings > Mobile > Third Party Connections > API Token
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
@@ -46,6 +48,7 @@ The CLI should now be discoverable as `slobs-cli`
|
|||||||
- --domain/-d: Streamlabs client domain
|
- --domain/-d: Streamlabs client domain
|
||||||
- --port/-p Streamlabs client port
|
- --port/-p Streamlabs client port
|
||||||
- --token/-t: API Token
|
- --token/-t: API Token
|
||||||
|
- --version/-v: Print the slobs-cli version
|
||||||
|
|
||||||
Pass `--domain`, `--port` and `--token` as flags on the root command, for example:
|
Pass `--domain`, `--port` and `--token` as flags on the root command, for example:
|
||||||
|
|
||||||
@@ -67,17 +70,56 @@ Flags can be used to override environment variables.
|
|||||||
|
|
||||||
[sl-desktop]: https://streamlabs.com/streamlabs-live-streaming-software?srsltid=AfmBOopnswGBgEyvVSi2DIc_vsGovKn2HQZyLw1Cg6LEo51OJhONXnAX
|
[sl-desktop]: https://streamlabs.com/streamlabs-live-streaming-software?srsltid=AfmBOopnswGBgEyvVSi2DIc_vsGovKn2HQZyLw1Cg6LEo51OJhONXnAX
|
||||||
|
|
||||||
|
## Style
|
||||||
|
|
||||||
|
Styling is opt-in, by default you will get a colourless output:
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
You may enable styling with the --style/-s flag:
|
||||||
|
|
||||||
|
```console
|
||||||
|
slobs-cli --style="yellow" audio list
|
||||||
|
```
|
||||||
|
|
||||||
|
Available styles: _red, magenta, purple, blue, cyan, green, yellow, orange, white, grey, navy, black_
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
Optionally you may disable border colouring with the --no-border flag:
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
```console
|
||||||
|
slobs-cli --style="yellow" --no-border audio list
|
||||||
|
```
|
||||||
|
|
||||||
|
Or with environment variables:
|
||||||
|
|
||||||
|
```env
|
||||||
|
SLOBS_STYLE=yellow
|
||||||
|
SLOBS_STYLE_NO_BORDER=true
|
||||||
|
```
|
||||||
|
|
||||||
## Commands
|
## Commands
|
||||||
|
|
||||||
#### Scene
|
#### Scene
|
||||||
|
|
||||||
- list: List all available scenes.
|
- list: List all available scenes.
|
||||||
|
- flags:
|
||||||
|
|
||||||
|
*optional*
|
||||||
|
- --id: Include scene IDs in the output.
|
||||||
|
|
||||||
```console
|
```console
|
||||||
slobs-cli scene list
|
slobs-cli scene list
|
||||||
```
|
```
|
||||||
|
|
||||||
- current: Show the currently active scene.
|
- current: Show the currently active scene.
|
||||||
|
- flags:
|
||||||
|
|
||||||
|
*optional*
|
||||||
|
- --id: Include scene IDs in the output.
|
||||||
|
|
||||||
```console
|
```console
|
||||||
slobs-cli scene current
|
slobs-cli scene current
|
||||||
@@ -87,7 +129,8 @@ slobs-cli scene current
|
|||||||
- flags:
|
- flags:
|
||||||
|
|
||||||
*optional*
|
*optional*
|
||||||
- --preview: Switch the preview scene only.
|
- --id: Include scene IDs in the output.
|
||||||
|
- --preview: Switch the preview scene.
|
||||||
- args: <scene_name>
|
- args: <scene_name>
|
||||||
|
|
||||||
```console
|
```console
|
||||||
@@ -149,6 +192,10 @@ slobs-cli record toggle
|
|||||||
#### Audio
|
#### Audio
|
||||||
|
|
||||||
- list: List all audio sources.
|
- list: List all audio sources.
|
||||||
|
- flags:
|
||||||
|
|
||||||
|
*optional*
|
||||||
|
- --id: Include audio source IDs in the output.
|
||||||
|
|
||||||
```console
|
```console
|
||||||
slobs-cli audio list
|
slobs-cli audio list
|
||||||
@@ -175,6 +222,12 @@ slobs-cli audio unmute "Mic/Aux"
|
|||||||
slobs-cli audio toggle "Mic/Aux"
|
slobs-cli audio toggle "Mic/Aux"
|
||||||
```
|
```
|
||||||
|
|
||||||
|
- status: Get the mute status of an audio source by name.
|
||||||
|
|
||||||
|
```console
|
||||||
|
slobs-cli audio status "Mic/Aux"
|
||||||
|
```
|
||||||
|
|
||||||
#### Replay Buffer
|
#### Replay Buffer
|
||||||
|
|
||||||
- start: Start the replay buffer.
|
- start: Start the replay buffer.
|
||||||
@@ -232,3 +285,111 @@ slobs-cli studiomode status
|
|||||||
```console
|
```console
|
||||||
slobs-cli studiomode force-transition
|
slobs-cli studiomode force-transition
|
||||||
```
|
```
|
||||||
|
|
||||||
|
#### Scene Collection
|
||||||
|
|
||||||
|
- list: List all scene collections.
|
||||||
|
- flags:
|
||||||
|
|
||||||
|
*optional*
|
||||||
|
- --id: Include scenecollection IDs in the output.
|
||||||
|
|
||||||
|
```console
|
||||||
|
slobs-cli scenecollection list
|
||||||
|
```
|
||||||
|
|
||||||
|
- create: Create a new scene collection.
|
||||||
|
- args: <scenecollection_name>
|
||||||
|
|
||||||
|
```console
|
||||||
|
slobs-cli scenecollection create "NewCollection"
|
||||||
|
```
|
||||||
|
|
||||||
|
- delete: Delete a scene collection by name.
|
||||||
|
- args: <scenecollection_name>
|
||||||
|
|
||||||
|
```console
|
||||||
|
slobs-cli scenecollection delete "ExistingCollection"
|
||||||
|
```
|
||||||
|
|
||||||
|
- load: Load a scene collection by name.
|
||||||
|
- args: <scenecollection_name>
|
||||||
|
|
||||||
|
```console
|
||||||
|
slobs-cli scenecollection load "ExistingCollection"
|
||||||
|
```
|
||||||
|
|
||||||
|
- rename: Rename a scene collection.
|
||||||
|
- args: <scenecollection_name> <new_name>
|
||||||
|
|
||||||
|
```console
|
||||||
|
slobs-cli scenecollection rename "ExistingCollection" "NewName"
|
||||||
|
```
|
||||||
|
|
||||||
|
## Shell Completion
|
||||||
|
|
||||||
|
Shell completion scripts are available for *bash*, *zsh*, and *fish*, you can find them in the [completions directory](./completions/).
|
||||||
|
|
||||||
|
#### Bash
|
||||||
|
|
||||||
|
Save the script in a completions directory of your choice.
|
||||||
|
|
||||||
|
```console
|
||||||
|
cp -v ./completions/_slobs-cli.bash ~/.completions/_slobs-cli
|
||||||
|
```
|
||||||
|
|
||||||
|
Source the file in `~/.bashrc`
|
||||||
|
|
||||||
|
```bash
|
||||||
|
. ~/.completions/_slobs-cli
|
||||||
|
```
|
||||||
|
|
||||||
|
Restart the shell
|
||||||
|
|
||||||
|
```console
|
||||||
|
exec "$SHELL"
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Fish
|
||||||
|
|
||||||
|
Save the script to `~/.config/fish/completions`
|
||||||
|
|
||||||
|
```fish
|
||||||
|
cp -v ./completions/_slobs-cli.fish ~/.config/fish/completions/_slobs-cli
|
||||||
|
```
|
||||||
|
|
||||||
|
Restart the shell
|
||||||
|
|
||||||
|
```console
|
||||||
|
exec "$SHELL"
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Zsh
|
||||||
|
|
||||||
|
Save the script in a completions directory of your choice.
|
||||||
|
|
||||||
|
```console
|
||||||
|
cp -v ./completions/_slobs-cli.zsh ~/.completions/_slobs-cli
|
||||||
|
```
|
||||||
|
|
||||||
|
Source the file in `~/.zshrc`
|
||||||
|
|
||||||
|
```zsh
|
||||||
|
. ~/.completions/_slobs-cli
|
||||||
|
```
|
||||||
|
|
||||||
|
> Note: If you're using a framework like oh-my-zsh you can copy the completion script straight into $ZSH_CUSTOM/completions and skip modifying ~/.zshrc
|
||||||
|
|
||||||
|
Restart the shell
|
||||||
|
|
||||||
|
```console
|
||||||
|
exec "$SHELL"
|
||||||
|
```
|
||||||
|
|
||||||
|
## Special Thanks
|
||||||
|
|
||||||
|
- [Julian-0](https://github.com/Julian-O) For writing the [PySLOBS wrapper](https://github.com/Julian-O/PySLOBS) on which this CLI depends.
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
`slobs-cli` is distributed under the terms of the [MIT](https://spdx.org/licenses/MIT.html) license.
|
||||||
|
|||||||
33
Taskfile.yaml
Normal file
33
Taskfile.yaml
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
version: '3'
|
||||||
|
|
||||||
|
tasks:
|
||||||
|
default:
|
||||||
|
desc: Generate completion scripts for supported shells
|
||||||
|
cmds:
|
||||||
|
- task: generate-completion-scripts
|
||||||
|
|
||||||
|
generate-completion-scripts:
|
||||||
|
desc: Generate completion scripts for supported shells
|
||||||
|
cmds:
|
||||||
|
- for:
|
||||||
|
matrix:
|
||||||
|
SHELL: [bash, fish, zsh]
|
||||||
|
task: generate-completion-script-{{.ITEM.SHELL}}
|
||||||
|
|
||||||
|
generate-completion-script-bash:
|
||||||
|
desc: Generate bash completion script
|
||||||
|
cmds:
|
||||||
|
- bash -c '_SLOBS_CLI_COMPLETE=bash_source slobs-cli > ./completions/_slobs-cli.bash'
|
||||||
|
internal: true
|
||||||
|
|
||||||
|
generate-completion-script-fish:
|
||||||
|
desc: Generate fish completion script
|
||||||
|
cmds:
|
||||||
|
- fish -c '_SLOBS_CLI_COMPLETE=fish_source slobs-cli > ./completions/_slobs-cli.fish'
|
||||||
|
internal: true
|
||||||
|
|
||||||
|
generate-completion-script-zsh:
|
||||||
|
desc: Generate zsh completion script
|
||||||
|
cmds:
|
||||||
|
- zsh -c '_SLOBS_CLI_COMPLETE=zsh_source slobs-cli > ./completions/_slobs-cli.zsh'
|
||||||
|
internal: true
|
||||||
28
completions/_slobs-cli.bash
Normal file
28
completions/_slobs-cli.bash
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
_slobs_cli_completion() {
|
||||||
|
local IFS=$'\n'
|
||||||
|
local response
|
||||||
|
|
||||||
|
response=$(env COMP_WORDS="${COMP_WORDS[*]}" COMP_CWORD=$COMP_CWORD _SLOBS_CLI_COMPLETE=bash_complete $1)
|
||||||
|
|
||||||
|
for completion in $response; do
|
||||||
|
IFS=',' read type value <<< "$completion"
|
||||||
|
|
||||||
|
if [[ $type == 'dir' ]]; then
|
||||||
|
COMPREPLY=()
|
||||||
|
compopt -o dirnames
|
||||||
|
elif [[ $type == 'file' ]]; then
|
||||||
|
COMPREPLY=()
|
||||||
|
compopt -o default
|
||||||
|
elif [[ $type == 'plain' ]]; then
|
||||||
|
COMPREPLY+=($value)
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
_slobs_cli_completion_setup() {
|
||||||
|
complete -o nosort -F _slobs_cli_completion slobs-cli
|
||||||
|
}
|
||||||
|
|
||||||
|
_slobs_cli_completion_setup;
|
||||||
17
completions/_slobs-cli.fish
Normal file
17
completions/_slobs-cli.fish
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
function _slobs_cli_completion;
|
||||||
|
set -l response (env _SLOBS_CLI_COMPLETE=fish_complete COMP_WORDS=(commandline -cp) COMP_CWORD=(commandline -t) slobs-cli);
|
||||||
|
|
||||||
|
for completion in $response;
|
||||||
|
set -l metadata (string split "," $completion);
|
||||||
|
|
||||||
|
if test $metadata[1] = "dir";
|
||||||
|
__fish_complete_directories $metadata[2];
|
||||||
|
else if test $metadata[1] = "file";
|
||||||
|
__fish_complete_path $metadata[2];
|
||||||
|
else if test $metadata[1] = "plain";
|
||||||
|
echo $metadata[2];
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
complete --no-files --command slobs-cli --arguments "(_slobs_cli_completion)";
|
||||||
40
completions/_slobs-cli.zsh
Normal file
40
completions/_slobs-cli.zsh
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
#compdef slobs-cli
|
||||||
|
|
||||||
|
_slobs_cli_completion() {
|
||||||
|
local -a completions
|
||||||
|
local -a completions_with_descriptions
|
||||||
|
local -a response
|
||||||
|
(( ! $+commands[slobs-cli] )) && return 1
|
||||||
|
|
||||||
|
response=("${(@f)$(env COMP_WORDS="${words[*]}" COMP_CWORD=$((CURRENT-1)) _SLOBS_CLI_COMPLETE=zsh_complete slobs-cli)}")
|
||||||
|
|
||||||
|
for type key descr in ${response}; do
|
||||||
|
if [[ "$type" == "plain" ]]; then
|
||||||
|
if [[ "$descr" == "_" ]]; then
|
||||||
|
completions+=("$key")
|
||||||
|
else
|
||||||
|
completions_with_descriptions+=("$key":"$descr")
|
||||||
|
fi
|
||||||
|
elif [[ "$type" == "dir" ]]; then
|
||||||
|
_path_files -/
|
||||||
|
elif [[ "$type" == "file" ]]; then
|
||||||
|
_path_files -f
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ -n "$completions_with_descriptions" ]; then
|
||||||
|
_describe -V unsorted completions_with_descriptions -U
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -n "$completions" ]; then
|
||||||
|
compadd -U -V unsorted -a completions
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
if [[ $zsh_eval_context[-1] == loadautofunc ]]; then
|
||||||
|
# autoload from fpath, call function directly
|
||||||
|
_slobs_cli_completion "$@"
|
||||||
|
else
|
||||||
|
# eval/source/. command, register function for later
|
||||||
|
compdef _slobs_cli_completion slobs-cli
|
||||||
|
fi
|
||||||
BIN
img/coloured-border.png
Executable file
BIN
img/coloured-border.png
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 4.4 KiB |
BIN
img/coloured-no-border.png
Executable file
BIN
img/coloured-no-border.png
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 4.4 KiB |
BIN
img/colourless.png
Executable file
BIN
img/colourless.png
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 3.7 KiB |
317
pdm.lock
generated
317
pdm.lock
generated
@@ -5,53 +5,50 @@
|
|||||||
groups = ["default", "dev"]
|
groups = ["default", "dev"]
|
||||||
strategy = ["inherit_metadata"]
|
strategy = ["inherit_metadata"]
|
||||||
lock_version = "4.5.0"
|
lock_version = "4.5.0"
|
||||||
content_hash = "sha256:b032bb4d22d3d3b10233c543cd182ac8e7ec052aa9dc03a3034a967066e85db2"
|
content_hash = "sha256:657780adc251e4b26f1c7798388f7e7442549af2cbdac53fa23b39c40acb28ba"
|
||||||
|
|
||||||
[[metadata.targets]]
|
[[metadata.targets]]
|
||||||
requires_python = ">=3.10"
|
requires_python = ">=3.11"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "anyio"
|
name = "anyio"
|
||||||
version = "4.9.0"
|
version = "4.12.0"
|
||||||
requires_python = ">=3.9"
|
requires_python = ">=3.9"
|
||||||
summary = "High level compatibility layer for multiple asynchronous event loop implementations"
|
summary = "High-level concurrency and networking framework on top of asyncio or Trio"
|
||||||
groups = ["default"]
|
groups = ["default"]
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"exceptiongroup>=1.0.2; python_version < \"3.11\"",
|
"exceptiongroup>=1.0.2; python_version < \"3.11\"",
|
||||||
"idna>=2.8",
|
"idna>=2.8",
|
||||||
"sniffio>=1.1",
|
|
||||||
"typing-extensions>=4.5; python_version < \"3.13\"",
|
"typing-extensions>=4.5; python_version < \"3.13\"",
|
||||||
]
|
]
|
||||||
files = [
|
files = [
|
||||||
{file = "anyio-4.9.0-py3-none-any.whl", hash = "sha256:9f76d541cad6e36af7beb62e978876f3b41e3e04f2c1fbf0884604c0a9c4d93c"},
|
{file = "anyio-4.12.0-py3-none-any.whl", hash = "sha256:dad2376a628f98eeca4881fc56cd06affd18f659b17a747d3ff0307ced94b1bb"},
|
||||||
{file = "anyio-4.9.0.tar.gz", hash = "sha256:673c0c244e15788651a4ff38710fea9675823028a6f08a5eda409e0c9840a028"},
|
{file = "anyio-4.12.0.tar.gz", hash = "sha256:73c693b567b0c55130c104d0b43a9baf3aa6a31fc6110116509f27bf75e21ec0"},
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "asyncclick"
|
name = "asyncclick"
|
||||||
version = "8.1.8"
|
version = "8.3.0.7"
|
||||||
requires_python = ">=3.9"
|
requires_python = ">=3.11"
|
||||||
summary = "Composable command line interface toolkit, "
|
summary = "Composable command line interface toolkit, async fork"
|
||||||
groups = ["default"]
|
groups = ["default"]
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyio~=4.0",
|
|
||||||
"colorama; platform_system == \"Windows\"",
|
"colorama; platform_system == \"Windows\"",
|
||||||
]
|
]
|
||||||
files = [
|
files = [
|
||||||
{file = "asyncclick-8.1.8-py3-none-any.whl", hash = "sha256:eb1ccb44bc767f8f0695d592c7806fdf5bd575605b4ee246ffd5fadbcfdbd7c6"},
|
{file = "asyncclick-8.3.0.7-py3-none-any.whl", hash = "sha256:7607046de39a3f315867cad818849f973e29d350c10d92f251db3ff7600c6c7d"},
|
||||||
{file = "asyncclick-8.1.8.0-py3-none-any.whl", hash = "sha256:be146a2d8075d4fe372ff4e877f23c8b5af269d16705c1948123b9415f6fd678"},
|
{file = "asyncclick-8.3.0.7.tar.gz", hash = "sha256:8a80d8ac613098ee6a9a8f0248f60c66c273e22402cf3f115ed7f071acfc71d3"},
|
||||||
{file = "asyncclick-8.1.8.tar.gz", hash = "sha256:0f0eb0f280e04919d67cf71b9fcdfb4db2d9ff7203669c40284485c149578e4c"},
|
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cachetools"
|
name = "cachetools"
|
||||||
version = "6.0.0"
|
version = "6.2.4"
|
||||||
requires_python = ">=3.9"
|
requires_python = ">=3.9"
|
||||||
summary = "Extensible memoizing collections and decorators"
|
summary = "Extensible memoizing collections and decorators"
|
||||||
groups = ["dev"]
|
groups = ["dev"]
|
||||||
files = [
|
files = [
|
||||||
{file = "cachetools-6.0.0-py3-none-any.whl", hash = "sha256:82e73ba88f7b30228b5507dce1a1f878498fc669d972aef2dde4f3a3c24f103e"},
|
{file = "cachetools-6.2.4-py3-none-any.whl", hash = "sha256:69a7a52634fed8b8bf6e24a050fb60bff1c9bd8f6d24572b99c32d4e71e62a51"},
|
||||||
{file = "cachetools-6.0.0.tar.gz", hash = "sha256:f225782b84438f828328fc2ad74346522f27e5b1440f4e9fd18b20ebfd1aa2cf"},
|
{file = "cachetools-6.2.4.tar.gz", hash = "sha256:82c5c05585e70b6ba2d3ae09ea60b79548872185d2f24ae1f2709d37299fd607"},
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -78,60 +75,70 @@ files = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "distlib"
|
name = "distlib"
|
||||||
version = "0.3.9"
|
version = "0.4.0"
|
||||||
summary = "Distribution utilities"
|
summary = "Distribution utilities"
|
||||||
groups = ["dev"]
|
groups = ["dev"]
|
||||||
files = [
|
files = [
|
||||||
{file = "distlib-0.3.9-py2.py3-none-any.whl", hash = "sha256:47f8c22fd27c27e25a65601af709b38e4f0a45ea4fc2e710f65755fa8caaaf87"},
|
{file = "distlib-0.4.0-py2.py3-none-any.whl", hash = "sha256:9659f7d87e46584a30b5780e43ac7a2143098441670ff0a49d5f9034c54a6c16"},
|
||||||
{file = "distlib-0.3.9.tar.gz", hash = "sha256:a60f20dea646b8a33f3e7772f74dc0b2d0772d2837ee1342a00645c81edf9403"},
|
{file = "distlib-0.4.0.tar.gz", hash = "sha256:feec40075be03a04501a973d81f633735b4b69f98b05450592310c0f401a4e0d"},
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "exceptiongroup"
|
|
||||||
version = "1.3.0"
|
|
||||||
requires_python = ">=3.7"
|
|
||||||
summary = "Backport of PEP 654 (exception groups)"
|
|
||||||
groups = ["default", "dev"]
|
|
||||||
marker = "python_version < \"3.11\""
|
|
||||||
dependencies = [
|
|
||||||
"typing-extensions>=4.6.0; python_version < \"3.13\"",
|
|
||||||
]
|
|
||||||
files = [
|
|
||||||
{file = "exceptiongroup-1.3.0-py3-none-any.whl", hash = "sha256:4d111e6e0c13d0644cad6ddaa7ed0261a0b36971f6d23e7ec9b4b9097da78a10"},
|
|
||||||
{file = "exceptiongroup-1.3.0.tar.gz", hash = "sha256:b241f5885f560bc56a59ee63ca4c6a8bfa46ae4ad651af316d4e81817bb9fd88"},
|
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "filelock"
|
name = "filelock"
|
||||||
version = "3.18.0"
|
version = "3.20.1"
|
||||||
requires_python = ">=3.9"
|
requires_python = ">=3.10"
|
||||||
summary = "A platform independent file lock."
|
summary = "A platform independent file lock."
|
||||||
groups = ["dev"]
|
groups = ["dev"]
|
||||||
files = [
|
files = [
|
||||||
{file = "filelock-3.18.0-py3-none-any.whl", hash = "sha256:c401f4f8377c4464e6db25fff06205fd89bdd83b65eb0488ed1b160f780e21de"},
|
{file = "filelock-3.20.1-py3-none-any.whl", hash = "sha256:15d9e9a67306188a44baa72f569d2bfd803076269365fdea0934385da4dc361a"},
|
||||||
{file = "filelock-3.18.0.tar.gz", hash = "sha256:adbc88eabb99d2fec8c9c1b229b171f18afa655400173ddc653d5d01501fb9f2"},
|
{file = "filelock-3.20.1.tar.gz", hash = "sha256:b8360948b351b80f420878d8516519a2204b07aefcdcfd24912a5d33127f188c"},
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "idna"
|
name = "idna"
|
||||||
version = "3.10"
|
version = "3.11"
|
||||||
requires_python = ">=3.6"
|
requires_python = ">=3.8"
|
||||||
summary = "Internationalized Domain Names in Applications (IDNA)"
|
summary = "Internationalized Domain Names in Applications (IDNA)"
|
||||||
groups = ["default"]
|
groups = ["default"]
|
||||||
files = [
|
files = [
|
||||||
{file = "idna-3.10-py3-none-any.whl", hash = "sha256:946d195a0d259cbba61165e88e65941f16e9b36ea6ddb97f00452bae8b1287d3"},
|
{file = "idna-3.11-py3-none-any.whl", hash = "sha256:771a87f49d9defaf64091e6e6fe9c18d4833f140bd19464795bc32d966ca37ea"},
|
||||||
{file = "idna-3.10.tar.gz", hash = "sha256:12f65c9b470abda6dc35cf8e63cc574b1c52b11df2c86030af0ac09b01b13ea9"},
|
{file = "idna-3.11.tar.gz", hash = "sha256:795dafcc9c04ed0c1fb032c2aa73654d8e8c5023a7df64a53f39190ada629902"},
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "iniconfig"
|
name = "iniconfig"
|
||||||
version = "2.1.0"
|
version = "2.3.0"
|
||||||
requires_python = ">=3.8"
|
requires_python = ">=3.10"
|
||||||
summary = "brain-dead simple config-ini parsing"
|
summary = "brain-dead simple config-ini parsing"
|
||||||
groups = ["dev"]
|
groups = ["dev"]
|
||||||
files = [
|
files = [
|
||||||
{file = "iniconfig-2.1.0-py3-none-any.whl", hash = "sha256:9deba5723312380e77435581c6bf4935c94cbfab9b1ed33ef8d238ea168eb760"},
|
{file = "iniconfig-2.3.0-py3-none-any.whl", hash = "sha256:f631c04d2c48c52b84d0d0549c99ff3859c98df65b3101406327ecc7d53fbf12"},
|
||||||
{file = "iniconfig-2.1.0.tar.gz", hash = "sha256:3abbd2e30b36733fee78f9c7f7308f2d0050e88f0087fd25c2645f63c773e1c7"},
|
{file = "iniconfig-2.3.0.tar.gz", hash = "sha256:c76315c77db068650d49c5b56314774a7804df16fee4402c1f19d6d15d8c4730"},
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "markdown-it-py"
|
||||||
|
version = "4.0.0"
|
||||||
|
requires_python = ">=3.10"
|
||||||
|
summary = "Python port of markdown-it. Markdown parsing, done right!"
|
||||||
|
groups = ["default"]
|
||||||
|
dependencies = [
|
||||||
|
"mdurl~=0.1",
|
||||||
|
]
|
||||||
|
files = [
|
||||||
|
{file = "markdown_it_py-4.0.0-py3-none-any.whl", hash = "sha256:87327c59b172c5011896038353a81343b6754500a08cd7a4973bb48c6d578147"},
|
||||||
|
{file = "markdown_it_py-4.0.0.tar.gz", hash = "sha256:cb0a2b4aa34f932c007117b194e945bd74e0ec24133ceb5bac59009cda1cb9f3"},
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "mdurl"
|
||||||
|
version = "0.1.2"
|
||||||
|
requires_python = ">=3.7"
|
||||||
|
summary = "Markdown URL utilities"
|
||||||
|
groups = ["default"]
|
||||||
|
files = [
|
||||||
|
{file = "mdurl-0.1.2-py3-none-any.whl", hash = "sha256:84008a41e51615a49fc9966191ff91509e3c40b939176e643fd50a5c2196b8f8"},
|
||||||
|
{file = "mdurl-0.1.2.tar.gz", hash = "sha256:bb413d29f5eea38f31dd4754dd7377d4465116fb207585f97bf925588687c1ba"},
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -147,13 +154,13 @@ files = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "platformdirs"
|
name = "platformdirs"
|
||||||
version = "4.3.8"
|
version = "4.5.1"
|
||||||
requires_python = ">=3.9"
|
requires_python = ">=3.10"
|
||||||
summary = "A small Python package for determining appropriate platform-specific dirs, e.g. a `user data dir`."
|
summary = "A small Python package for determining appropriate platform-specific dirs, e.g. a `user data dir`."
|
||||||
groups = ["dev"]
|
groups = ["dev"]
|
||||||
files = [
|
files = [
|
||||||
{file = "platformdirs-4.3.8-py3-none-any.whl", hash = "sha256:ff7059bb7eb1179e2685604f4aaf157cfd9535242bd23742eadc3c13542139b4"},
|
{file = "platformdirs-4.5.1-py3-none-any.whl", hash = "sha256:d03afa3963c806a9bed9d5125c8f4cb2fdaf74a55ab60e5d59b3fde758104d31"},
|
||||||
{file = "platformdirs-4.3.8.tar.gz", hash = "sha256:3d512d96e16bcb959a814c9f348431070822a6496326a4be0911c40b5a74c2bc"},
|
{file = "platformdirs-4.5.1.tar.gz", hash = "sha256:61d5cdcc6065745cdd94f0f878977f8de9437be93de97c1c12f853c9c0cdcbda"},
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -169,150 +176,155 @@ files = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "pyenv-inspect"
|
name = "pyenv-inspect"
|
||||||
version = "0.4.0"
|
version = "0.5.0"
|
||||||
requires_python = ">=3.8"
|
requires_python = ">=3.9"
|
||||||
summary = "An auxiliary library for the virtualenv-pyenv and tox-pyenv-redux plugins"
|
summary = "An auxiliary library for the virtualenv-pyenv and tox-pyenv-redux plugins"
|
||||||
groups = ["dev"]
|
groups = ["dev"]
|
||||||
files = [
|
files = [
|
||||||
{file = "pyenv-inspect-0.4.0.tar.gz", hash = "sha256:ec429d1d81b67ab0b08a0408414722a79d24fd1845a5b264267e44e19d8d60f0"},
|
{file = "pyenv_inspect-0.5.0-py3-none-any.whl", hash = "sha256:ada3d3ea49b8604ff330d06a39ffe46df120d31c0bc9796392a41f2c3b34b08e"},
|
||||||
{file = "pyenv_inspect-0.4.0-py3-none-any.whl", hash = "sha256:618683ae7d3e6db14778d58aa0fc6b3170180d944669b5d35a8aa4fb7db550d2"},
|
{file = "pyenv_inspect-0.5.0.tar.gz", hash = "sha256:acaec63227577ac6edd3e775036d7bb0077d8ed2ebce5021e176a732e20c84d3"},
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "pygments"
|
name = "pygments"
|
||||||
version = "2.19.1"
|
version = "2.19.2"
|
||||||
requires_python = ">=3.8"
|
requires_python = ">=3.8"
|
||||||
summary = "Pygments is a syntax highlighting package written in Python."
|
summary = "Pygments is a syntax highlighting package written in Python."
|
||||||
groups = ["dev"]
|
groups = ["default", "dev"]
|
||||||
files = [
|
files = [
|
||||||
{file = "pygments-2.19.1-py3-none-any.whl", hash = "sha256:9ea1544ad55cecf4b8242fab6dd35a93bbce657034b0611ee383099054ab6d8c"},
|
{file = "pygments-2.19.2-py3-none-any.whl", hash = "sha256:86540386c03d588bb81d44bc3928634ff26449851e99741617ecb9037ee5ec0b"},
|
||||||
{file = "pygments-2.19.1.tar.gz", hash = "sha256:61c16d2a8576dc0649d9f39e089b5f02bcd27fba10d8fb4dcc28173f7a45151f"},
|
{file = "pygments-2.19.2.tar.gz", hash = "sha256:636cb2477cec7f8952536970bc533bc43743542f70392ae026374600add5b887"},
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "pyproject-api"
|
name = "pyproject-api"
|
||||||
version = "1.9.1"
|
version = "1.10.0"
|
||||||
requires_python = ">=3.9"
|
requires_python = ">=3.10"
|
||||||
summary = "API to interact with the python pyproject.toml based projects"
|
summary = "API to interact with the python pyproject.toml based projects"
|
||||||
groups = ["dev"]
|
groups = ["dev"]
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"packaging>=25",
|
"packaging>=25",
|
||||||
"tomli>=2.2.1; python_version < \"3.11\"",
|
"tomli>=2.3; python_version < \"3.11\"",
|
||||||
]
|
]
|
||||||
files = [
|
files = [
|
||||||
{file = "pyproject_api-1.9.1-py3-none-any.whl", hash = "sha256:7d6238d92f8962773dd75b5f0c4a6a27cce092a14b623b811dba656f3b628948"},
|
{file = "pyproject_api-1.10.0-py3-none-any.whl", hash = "sha256:8757c41a79c0f4ab71b99abed52b97ecf66bd20b04fa59da43b5840bac105a09"},
|
||||||
{file = "pyproject_api-1.9.1.tar.gz", hash = "sha256:43c9918f49daab37e302038fc1aed54a8c7a91a9fa935d00b9a485f37e0f5335"},
|
{file = "pyproject_api-1.10.0.tar.gz", hash = "sha256:40c6f2d82eebdc4afee61c773ed208c04c19db4c4a60d97f8d7be3ebc0bbb330"},
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "pyslobs"
|
name = "pyslobs"
|
||||||
version = "2.0.4"
|
version = "2.1.0"
|
||||||
requires_python = ">=3.9"
|
requires_python = ">=3.10"
|
||||||
summary = "Python wrapper to StreamLabs Desktop API"
|
summary = "Python wrapper to StreamLabs Desktop API"
|
||||||
groups = ["default"]
|
groups = ["default"]
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"websocket-client",
|
"websocket-client",
|
||||||
]
|
]
|
||||||
files = [
|
files = [
|
||||||
{file = "PySLOBS-2.0.4-py3-none-any.whl", hash = "sha256:c9cc8cd3f5f22800f23589ae0607d78d8c4257c7c6a9770d651c63a76f512784"},
|
{file = "pyslobs-2.1.0-py3-none-any.whl", hash = "sha256:b0fe85dce75a8faae5dfd8ee717971a732d45602d97cc5eaa653a116878d5e92"},
|
||||||
{file = "pyslobs-2.0.4.tar.gz", hash = "sha256:a1e855b62cf4dd1208131fd58d925022dde8f057e33a0cb4933fd55efee876c7"},
|
{file = "pyslobs-2.1.0.tar.gz", hash = "sha256:244c67563cffd56fd1b39a03552d125ad7c2c8fefff6b42c4153bbfe29984fa1"},
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "pytest"
|
name = "pytest"
|
||||||
version = "8.4.0"
|
version = "9.0.2"
|
||||||
requires_python = ">=3.9"
|
requires_python = ">=3.10"
|
||||||
summary = "pytest: simple powerful testing with Python"
|
summary = "pytest: simple powerful testing with Python"
|
||||||
groups = ["dev"]
|
groups = ["dev"]
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"colorama>=0.4; sys_platform == \"win32\"",
|
"colorama>=0.4; sys_platform == \"win32\"",
|
||||||
"exceptiongroup>=1; python_version < \"3.11\"",
|
"exceptiongroup>=1; python_version < \"3.11\"",
|
||||||
"iniconfig>=1",
|
"iniconfig>=1.0.1",
|
||||||
"packaging>=20",
|
"packaging>=22",
|
||||||
"pluggy<2,>=1.5",
|
"pluggy<2,>=1.5",
|
||||||
"pygments>=2.7.2",
|
"pygments>=2.7.2",
|
||||||
"tomli>=1; python_version < \"3.11\"",
|
"tomli>=1; python_version < \"3.11\"",
|
||||||
]
|
]
|
||||||
files = [
|
files = [
|
||||||
{file = "pytest-8.4.0-py3-none-any.whl", hash = "sha256:f40f825768ad76c0977cbacdf1fd37c6f7a468e460ea6a0636078f8972d4517e"},
|
{file = "pytest-9.0.2-py3-none-any.whl", hash = "sha256:711ffd45bf766d5264d487b917733b453d917afd2b0ad65223959f59089f875b"},
|
||||||
{file = "pytest-8.4.0.tar.gz", hash = "sha256:14d920b48472ea0dbf68e45b96cd1ffda4705f33307dcc86c676c1b5104838a6"},
|
{file = "pytest-9.0.2.tar.gz", hash = "sha256:75186651a92bd89611d1d9fc20f0b4345fd827c41ccd5c299a868a05d70edf11"},
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "sniffio"
|
name = "pytest-randomly"
|
||||||
version = "1.3.1"
|
version = "4.0.1"
|
||||||
requires_python = ">=3.7"
|
requires_python = ">=3.9"
|
||||||
summary = "Sniff out which async library your code is running under"
|
summary = "Pytest plugin to randomly order tests and control random.seed."
|
||||||
groups = ["default"]
|
|
||||||
files = [
|
|
||||||
{file = "sniffio-1.3.1-py3-none-any.whl", hash = "sha256:2f6da418d1f1e0fddd844478f41680e794e6051915791a034ff65e5f100525a2"},
|
|
||||||
{file = "sniffio-1.3.1.tar.gz", hash = "sha256:f4324edc670a0f49750a81b895f35c3adb843cca46f0530f79fc1babb23789dc"},
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "tomli"
|
|
||||||
version = "2.2.1"
|
|
||||||
requires_python = ">=3.8"
|
|
||||||
summary = "A lil' TOML parser"
|
|
||||||
groups = ["dev"]
|
groups = ["dev"]
|
||||||
marker = "python_version < \"3.11\""
|
dependencies = [
|
||||||
|
"importlib-metadata>=3.6; python_version < \"3.10\"",
|
||||||
|
"pytest",
|
||||||
|
]
|
||||||
files = [
|
files = [
|
||||||
{file = "tomli-2.2.1-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:678e4fa69e4575eb77d103de3df8a895e1591b48e740211bd1067378c69e8249"},
|
{file = "pytest_randomly-4.0.1-py3-none-any.whl", hash = "sha256:e0dfad2fd4f35e07beff1e47c17fbafcf98f9bf4531fd369d9260e2f858bfcb7"},
|
||||||
{file = "tomli-2.2.1-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:023aa114dd824ade0100497eb2318602af309e5a55595f76b626d6d9f3b7b0a6"},
|
{file = "pytest_randomly-4.0.1.tar.gz", hash = "sha256:174e57bb12ac2c26f3578188490bd333f0e80620c3f47340158a86eca0593cd8"},
|
||||||
{file = "tomli-2.2.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:ece47d672db52ac607a3d9599a9d48dcb2f2f735c6c2d1f34130085bb12b112a"},
|
]
|
||||||
{file = "tomli-2.2.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6972ca9c9cc9f0acaa56a8ca1ff51e7af152a9f87fb64623e31d5c83700080ee"},
|
|
||||||
{file = "tomli-2.2.1-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:c954d2250168d28797dd4e3ac5cf812a406cd5a92674ee4c8f123c889786aa8e"},
|
[[package]]
|
||||||
{file = "tomli-2.2.1-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:8dd28b3e155b80f4d54beb40a441d366adcfe740969820caf156c019fb5c7ec4"},
|
name = "rich"
|
||||||
{file = "tomli-2.2.1-cp311-cp311-musllinux_1_2_i686.whl", hash = "sha256:e59e304978767a54663af13c07b3d1af22ddee3bb2fb0618ca1593e4f593a106"},
|
version = "14.2.0"
|
||||||
{file = "tomli-2.2.1-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:33580bccab0338d00994d7f16f4c4ec25b776af3ffaac1ed74e0b3fc95e885a8"},
|
requires_python = ">=3.8.0"
|
||||||
{file = "tomli-2.2.1-cp311-cp311-win32.whl", hash = "sha256:465af0e0875402f1d226519c9904f37254b3045fc5084697cefb9bdde1ff99ff"},
|
summary = "Render rich text, tables, progress bars, syntax highlighting, markdown and more to the terminal"
|
||||||
{file = "tomli-2.2.1-cp311-cp311-win_amd64.whl", hash = "sha256:2d0f2fdd22b02c6d81637a3c95f8cd77f995846af7414c5c4b8d0545afa1bc4b"},
|
groups = ["default"]
|
||||||
{file = "tomli-2.2.1-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:4a8f6e44de52d5e6c657c9fe83b562f5f4256d8ebbfe4ff922c495620a7f6cea"},
|
dependencies = [
|
||||||
{file = "tomli-2.2.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:8d57ca8095a641b8237d5b079147646153d22552f1c637fd3ba7f4b0b29167a8"},
|
"markdown-it-py>=2.2.0",
|
||||||
{file = "tomli-2.2.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:4e340144ad7ae1533cb897d406382b4b6fede8890a03738ff1683af800d54192"},
|
"pygments<3.0.0,>=2.13.0",
|
||||||
{file = "tomli-2.2.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:db2b95f9de79181805df90bedc5a5ab4c165e6ec3fe99f970d0e302f384ad222"},
|
]
|
||||||
{file = "tomli-2.2.1-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:40741994320b232529c802f8bc86da4e1aa9f413db394617b9a256ae0f9a7f77"},
|
files = [
|
||||||
{file = "tomli-2.2.1-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:400e720fe168c0f8521520190686ef8ef033fb19fc493da09779e592861b78c6"},
|
{file = "rich-14.2.0-py3-none-any.whl", hash = "sha256:76bc51fe2e57d2b1be1f96c524b890b816e334ab4c1e45888799bfaab0021edd"},
|
||||||
{file = "tomli-2.2.1-cp312-cp312-musllinux_1_2_i686.whl", hash = "sha256:02abe224de6ae62c19f090f68da4e27b10af2b93213d36cf44e6e1c5abd19fdd"},
|
{file = "rich-14.2.0.tar.gz", hash = "sha256:73ff50c7c0c1c77c8243079283f4edb376f0f6442433aecb8ce7e6d0b92d1fe4"},
|
||||||
{file = "tomli-2.2.1-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:b82ebccc8c8a36f2094e969560a1b836758481f3dc360ce9a3277c65f374285e"},
|
]
|
||||||
{file = "tomli-2.2.1-cp312-cp312-win32.whl", hash = "sha256:889f80ef92701b9dbb224e49ec87c645ce5df3fa2cc548664eb8a25e03127a98"},
|
|
||||||
{file = "tomli-2.2.1-cp312-cp312-win_amd64.whl", hash = "sha256:7fc04e92e1d624a4a63c76474610238576942d6b8950a2d7f908a340494e67e4"},
|
[[package]]
|
||||||
{file = "tomli-2.2.1-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:f4039b9cbc3048b2416cc57ab3bda989a6fcf9b36cf8937f01a6e731b64f80d7"},
|
name = "ruff"
|
||||||
{file = "tomli-2.2.1-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:286f0ca2ffeeb5b9bd4fcc8d6c330534323ec51b2f52da063b11c502da16f30c"},
|
version = "0.14.10"
|
||||||
{file = "tomli-2.2.1-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a92ef1a44547e894e2a17d24e7557a5e85a9e1d0048b0b5e7541f76c5032cb13"},
|
requires_python = ">=3.7"
|
||||||
{file = "tomli-2.2.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:9316dc65bed1684c9a98ee68759ceaed29d229e985297003e494aa825ebb0281"},
|
summary = "An extremely fast Python linter and code formatter, written in Rust."
|
||||||
{file = "tomli-2.2.1-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:e85e99945e688e32d5a35c1ff38ed0b3f41f43fad8df0bdf79f72b2ba7bc5272"},
|
groups = ["dev"]
|
||||||
{file = "tomli-2.2.1-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:ac065718db92ca818f8d6141b5f66369833d4a80a9d74435a268c52bdfa73140"},
|
files = [
|
||||||
{file = "tomli-2.2.1-cp313-cp313-musllinux_1_2_i686.whl", hash = "sha256:d920f33822747519673ee656a4b6ac33e382eca9d331c87770faa3eef562aeb2"},
|
{file = "ruff-0.14.10-py3-none-linux_armv6l.whl", hash = "sha256:7a3ce585f2ade3e1f29ec1b92df13e3da262178df8c8bdf876f48fa0e8316c49"},
|
||||||
{file = "tomli-2.2.1-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:a198f10c4d1b1375d7687bc25294306e551bf1abfa4eace6650070a5c1ae2744"},
|
{file = "ruff-0.14.10-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:674f9be9372907f7257c51f1d4fc902cb7cf014b9980152b802794317941f08f"},
|
||||||
{file = "tomli-2.2.1-cp313-cp313-win32.whl", hash = "sha256:d3f5614314d758649ab2ab3a62d4f2004c825922f9e370b29416484086b264ec"},
|
{file = "ruff-0.14.10-py3-none-macosx_11_0_arm64.whl", hash = "sha256:d85713d522348837ef9df8efca33ccb8bd6fcfc86a2cde3ccb4bc9d28a18003d"},
|
||||||
{file = "tomli-2.2.1-cp313-cp313-win_amd64.whl", hash = "sha256:a38aa0308e754b0e3c67e344754dff64999ff9b513e691d0e786265c93583c69"},
|
{file = "ruff-0.14.10-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:6987ebe0501ae4f4308d7d24e2d0fe3d7a98430f5adfd0f1fead050a740a3a77"},
|
||||||
{file = "tomli-2.2.1-py3-none-any.whl", hash = "sha256:cb55c73c5f4408779d0cf3eef9f762b9c9f147a77de7b258bef0a5628adc85cc"},
|
{file = "ruff-0.14.10-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:16a01dfb7b9e4eee556fbfd5392806b1b8550c9b4a9f6acd3dbe6812b193c70a"},
|
||||||
{file = "tomli-2.2.1.tar.gz", hash = "sha256:cd45e1dc79c835ce60f7404ec8119f2eb06d38b1deba146f07ced3bbc44505ff"},
|
{file = "ruff-0.14.10-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:7165d31a925b7a294465fa81be8c12a0e9b60fb02bf177e79067c867e71f8b1f"},
|
||||||
|
{file = "ruff-0.14.10-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:c561695675b972effb0c0a45db233f2c816ff3da8dcfbe7dfc7eed625f218935"},
|
||||||
|
{file = "ruff-0.14.10-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:4bb98fcbbc61725968893682fd4df8966a34611239c9fd07a1f6a07e7103d08e"},
|
||||||
|
{file = "ruff-0.14.10-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:f24b47993a9d8cb858429e97bdf8544c78029f09b520af615c1d261bf827001d"},
|
||||||
|
{file = "ruff-0.14.10-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:59aabd2e2c4fd614d2862e7939c34a532c04f1084476d6833dddef4afab87e9f"},
|
||||||
|
{file = "ruff-0.14.10-py3-none-manylinux_2_31_riscv64.whl", hash = "sha256:213db2b2e44be8625002dbea33bb9c60c66ea2c07c084a00d55732689d697a7f"},
|
||||||
|
{file = "ruff-0.14.10-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:b914c40ab64865a17a9a5b67911d14df72346a634527240039eb3bd650e5979d"},
|
||||||
|
{file = "ruff-0.14.10-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:1484983559f026788e3a5c07c81ef7d1e97c1c78ed03041a18f75df104c45405"},
|
||||||
|
{file = "ruff-0.14.10-py3-none-musllinux_1_2_i686.whl", hash = "sha256:c70427132db492d25f982fffc8d6c7535cc2fd2c83fc8888f05caaa248521e60"},
|
||||||
|
{file = "ruff-0.14.10-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:5bcf45b681e9f1ee6445d317ce1fa9d6cba9a6049542d1c3d5b5958986be8830"},
|
||||||
|
{file = "ruff-0.14.10-py3-none-win32.whl", hash = "sha256:104c49fc7ab73f3f3a758039adea978869a918f31b73280db175b43a2d9b51d6"},
|
||||||
|
{file = "ruff-0.14.10-py3-none-win_amd64.whl", hash = "sha256:466297bd73638c6bdf06485683e812db1c00c7ac96d4ddd0294a338c62fdc154"},
|
||||||
|
{file = "ruff-0.14.10-py3-none-win_arm64.whl", hash = "sha256:e51d046cf6dda98a4633b8a8a771451107413b0f07183b2bef03f075599e44e6"},
|
||||||
|
{file = "ruff-0.14.10.tar.gz", hash = "sha256:9a2e830f075d1a42cd28420d7809ace390832a490ed0966fe373ba288e77aaf4"},
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tox"
|
name = "tox"
|
||||||
version = "4.26.0"
|
version = "4.32.0"
|
||||||
requires_python = ">=3.9"
|
requires_python = ">=3.10"
|
||||||
summary = "tox is a generic virtualenv management and test command line tool"
|
summary = "tox is a generic virtualenv management and test command line tool"
|
||||||
groups = ["dev"]
|
groups = ["dev"]
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cachetools>=5.5.1",
|
"cachetools>=6.2",
|
||||||
"chardet>=5.2",
|
"chardet>=5.2",
|
||||||
"colorama>=0.4.6",
|
"colorama>=0.4.6",
|
||||||
"filelock>=3.16.1",
|
"filelock>=3.20",
|
||||||
"packaging>=24.2",
|
"packaging>=25",
|
||||||
"platformdirs>=4.3.6",
|
"platformdirs>=4.5",
|
||||||
"pluggy>=1.5",
|
"pluggy>=1.6",
|
||||||
"pyproject-api>=1.8",
|
"pyproject-api>=1.9.1",
|
||||||
"tomli>=2.2.1; python_version < \"3.11\"",
|
"tomli>=2.3; python_version < \"3.11\"",
|
||||||
"typing-extensions>=4.12.2; python_version < \"3.11\"",
|
"typing-extensions>=4.15; python_version < \"3.11\"",
|
||||||
"virtualenv>=20.31",
|
"virtualenv>=20.34",
|
||||||
]
|
]
|
||||||
files = [
|
files = [
|
||||||
{file = "tox-4.26.0-py3-none-any.whl", hash = "sha256:75f17aaf09face9b97bd41645028d9f722301e912be8b4c65a3f938024560224"},
|
{file = "tox-4.32.0-py3-none-any.whl", hash = "sha256:451e81dc02ba8d1ed20efd52ee409641ae4b5d5830e008af10fe8823ef1bd551"},
|
||||||
{file = "tox-4.26.0.tar.gz", hash = "sha256:a83b3b67b0159fa58e44e646505079e35a43317a62d2ae94725e0586266faeca"},
|
{file = "tox-4.32.0.tar.gz", hash = "sha256:1ad476b5f4d3679455b89a992849ffc3367560bbc7e9495ee8a3963542e7c8ff"},
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -332,19 +344,19 @@ files = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "typing-extensions"
|
name = "typing-extensions"
|
||||||
version = "4.14.0"
|
version = "4.15.0"
|
||||||
requires_python = ">=3.9"
|
requires_python = ">=3.9"
|
||||||
summary = "Backported and Experimental Type Hints for Python 3.9+"
|
summary = "Backported and Experimental Type Hints for Python 3.9+"
|
||||||
groups = ["default", "dev"]
|
groups = ["default"]
|
||||||
marker = "python_version < \"3.13\""
|
marker = "python_version < \"3.13\""
|
||||||
files = [
|
files = [
|
||||||
{file = "typing_extensions-4.14.0-py3-none-any.whl", hash = "sha256:a1514509136dd0b477638fc68d6a91497af5076466ad0fa6c338e44e359944af"},
|
{file = "typing_extensions-4.15.0-py3-none-any.whl", hash = "sha256:f0fa19c6845758ab08074a0cfa8b7aecb71c999ca73d62883bc25cc018c4e548"},
|
||||||
{file = "typing_extensions-4.14.0.tar.gz", hash = "sha256:8676b788e32f02ab42d9e7c61324048ae4c6d844a399eebace3d4979d75ceef4"},
|
{file = "typing_extensions-4.15.0.tar.gz", hash = "sha256:0cea48d173cc12fa28ecabc3b837ea3cf6f38c6d1136f85cbaaf598984861466"},
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "virtualenv"
|
name = "virtualenv"
|
||||||
version = "20.31.2"
|
version = "20.35.4"
|
||||||
requires_python = ">=3.8"
|
requires_python = ">=3.8"
|
||||||
summary = "Virtual Python Environment builder"
|
summary = "Virtual Python Environment builder"
|
||||||
groups = ["dev"]
|
groups = ["dev"]
|
||||||
@@ -353,34 +365,35 @@ dependencies = [
|
|||||||
"filelock<4,>=3.12.2",
|
"filelock<4,>=3.12.2",
|
||||||
"importlib-metadata>=6.6; python_version < \"3.8\"",
|
"importlib-metadata>=6.6; python_version < \"3.8\"",
|
||||||
"platformdirs<5,>=3.9.1",
|
"platformdirs<5,>=3.9.1",
|
||||||
|
"typing-extensions>=4.13.2; python_version < \"3.11\"",
|
||||||
]
|
]
|
||||||
files = [
|
files = [
|
||||||
{file = "virtualenv-20.31.2-py3-none-any.whl", hash = "sha256:36efd0d9650ee985f0cad72065001e66d49a6f24eb44d98980f630686243cf11"},
|
{file = "virtualenv-20.35.4-py3-none-any.whl", hash = "sha256:c21c9cede36c9753eeade68ba7d523529f228a403463376cf821eaae2b650f1b"},
|
||||||
{file = "virtualenv-20.31.2.tar.gz", hash = "sha256:e10c0a9d02835e592521be48b332b6caee6887f332c111aa79a09b9e79efc2af"},
|
{file = "virtualenv-20.35.4.tar.gz", hash = "sha256:643d3914d73d3eeb0c552cbb12d7e82adf0e504dbf86a3182f8771a153a1971c"},
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "virtualenv-pyenv"
|
name = "virtualenv-pyenv"
|
||||||
version = "0.5.0"
|
version = "0.6.0"
|
||||||
requires_python = ">=3.8"
|
requires_python = ">=3.9"
|
||||||
summary = "A virtualenv Python discovery plugin for pyenv-installed interpreters"
|
summary = "A virtualenv Python discovery plugin for pyenv-installed interpreters"
|
||||||
groups = ["dev"]
|
groups = ["dev"]
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"pyenv-inspect<0.5,>=0.4",
|
"pyenv-inspect<0.6,>=0.5",
|
||||||
"virtualenv",
|
"virtualenv>=20.29.0",
|
||||||
]
|
]
|
||||||
files = [
|
files = [
|
||||||
{file = "virtualenv-pyenv-0.5.0.tar.gz", hash = "sha256:7b0e5fe3dfbdf484f4cf9b01e1f98111e398db6942237910f666356e6293597f"},
|
{file = "virtualenv_pyenv-0.6.0-py3-none-any.whl", hash = "sha256:182fc36893dbf731ccdbc762d2172091f43dab90136c7755520c459054342195"},
|
||||||
{file = "virtualenv_pyenv-0.5.0-py3-none-any.whl", hash = "sha256:21750247e36c55b3c547cfdeb08f51a3867fe7129922991a4f9c96980c0a4a5d"},
|
{file = "virtualenv_pyenv-0.6.0.tar.gz", hash = "sha256:d85a1d73349203ec6605a75b596ae494263c6c32fcdafcf74c9ddfbcfdcd9094"},
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "websocket-client"
|
name = "websocket-client"
|
||||||
version = "1.8.0"
|
version = "1.9.0"
|
||||||
requires_python = ">=3.8"
|
requires_python = ">=3.9"
|
||||||
summary = "WebSocket client for Python with low level API options"
|
summary = "WebSocket client for Python with low level API options"
|
||||||
groups = ["default"]
|
groups = ["default"]
|
||||||
files = [
|
files = [
|
||||||
{file = "websocket_client-1.8.0-py3-none-any.whl", hash = "sha256:17b44cc997f5c498e809b22cdf2d9c7a9e71c02c8cc2b6c56e7c2d1239bfa526"},
|
{file = "websocket_client-1.9.0-py3-none-any.whl", hash = "sha256:af248a825037ef591efbf6ed20cc5faa03d3b47b9e5a2230a529eeee1c1fc3ef"},
|
||||||
{file = "websocket_client-1.8.0.tar.gz", hash = "sha256:3239df9f44da632f96012472805d40a23281a991027ce11d2f45a6f24ac4c3da"},
|
{file = "websocket_client-1.9.0.tar.gz", hash = "sha256:9e813624b6eb619999a97dc7958469217c3176312b3a16a4bd1bc7e08a46ec98"},
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -1,12 +1,17 @@
|
|||||||
[project]
|
[project]
|
||||||
name = "slobs-cli"
|
name = "slobs-cli"
|
||||||
version = "0.7.5"
|
|
||||||
description = "A command line application for Streamlabs Desktop"
|
description = "A command line application for Streamlabs Desktop"
|
||||||
authors = [{ name = "onyx-and-iris", email = "code@onyxandiris.online" }]
|
authors = [{ name = "onyx-and-iris", email = "code@onyxandiris.online" }]
|
||||||
dependencies = ["pyslobs>=2.0.4", "asyncclick>=8.1.8"]
|
dependencies = [
|
||||||
requires-python = ">=3.10"
|
"pyslobs>=2.0.5",
|
||||||
|
"asyncclick>=8.1.8",
|
||||||
|
"rich>=14.0.0",
|
||||||
|
"anyio>=4.12.0",
|
||||||
|
]
|
||||||
|
requires-python = ">=3.11"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
license = { text = "MIT" }
|
license = { text = "MIT" }
|
||||||
|
dynamic = ["version"]
|
||||||
|
|
||||||
[project.scripts]
|
[project.scripts]
|
||||||
slobs-cli = "slobs_cli.cli:run"
|
slobs-cli = "slobs_cli.cli:run"
|
||||||
@@ -19,17 +24,30 @@ build-backend = "pdm.backend"
|
|||||||
[tool.pdm]
|
[tool.pdm]
|
||||||
distribution = true
|
distribution = true
|
||||||
|
|
||||||
[tool.pdm.scripts]
|
[tool.pdm.version]
|
||||||
cli.cmd = "slobs-cli {args}"
|
source = "file"
|
||||||
cli.env_file = ".env"
|
path = "src/slobs_cli/__about__.py"
|
||||||
|
|
||||||
test.cmd = "pytest {args}"
|
[tool.pdm.scripts]
|
||||||
test.env_file = ".env"
|
_.env_file = ".env"
|
||||||
post_test.cmd = "python tests/teardown.py"
|
|
||||||
|
cli.cmd = "slobs-cli {args}"
|
||||||
|
|
||||||
|
_setup.cmd = "python tests/setup.py"
|
||||||
|
_teardown.cmd = "python tests/teardown.py"
|
||||||
|
test.composite = ["_setup", "pytest {args}", "_teardown"]
|
||||||
|
test.keep_going = true
|
||||||
|
|
||||||
|
fmt.cmd = "ruff format {args}"
|
||||||
|
post_fmt.cmd = "ruff check {args}"
|
||||||
|
|
||||||
|
completion.cmd = "task generate-completion-scripts"
|
||||||
|
|
||||||
[dependency-groups]
|
[dependency-groups]
|
||||||
dev = [
|
dev = [
|
||||||
"tox-pdm>=0.7.2",
|
"tox-pdm>=0.7.2",
|
||||||
"pytest>=8.4.0",
|
"pytest>=8.4.0",
|
||||||
|
"pytest-randomly>=3.16.0",
|
||||||
"virtualenv-pyenv>=0.5.0",
|
"virtualenv-pyenv>=0.5.0",
|
||||||
|
"ruff>=0.11.13",
|
||||||
]
|
]
|
||||||
|
|||||||
79
ruff.toml
Normal file
79
ruff.toml
Normal file
@@ -0,0 +1,79 @@
|
|||||||
|
# Exclude a variety of commonly ignored directories.
|
||||||
|
exclude = [
|
||||||
|
".bzr",
|
||||||
|
".direnv",
|
||||||
|
".eggs",
|
||||||
|
".git",
|
||||||
|
".git-rewrite",
|
||||||
|
".hatch",
|
||||||
|
".hg",
|
||||||
|
".ipynb_checkpoints",
|
||||||
|
".mypy_cache",
|
||||||
|
".nox",
|
||||||
|
".pants.d",
|
||||||
|
".pyenv",
|
||||||
|
".pytest_cache",
|
||||||
|
".pytype",
|
||||||
|
".ruff_cache",
|
||||||
|
".svn",
|
||||||
|
".tox",
|
||||||
|
".venv",
|
||||||
|
".vscode",
|
||||||
|
"__pypackages__",
|
||||||
|
"_build",
|
||||||
|
"buck-out",
|
||||||
|
"build",
|
||||||
|
"dist",
|
||||||
|
"node_modules",
|
||||||
|
"site-packages",
|
||||||
|
"venv",
|
||||||
|
]
|
||||||
|
|
||||||
|
# Same as Black.
|
||||||
|
line-length = 88
|
||||||
|
indent-width = 4
|
||||||
|
|
||||||
|
# Assume Python 3.11
|
||||||
|
target-version = "py311"
|
||||||
|
|
||||||
|
[lint]
|
||||||
|
# Enable Pyflakes (`F`) and a subset of the pycodestyle (`E`) codes by default.
|
||||||
|
# Unlike Flake8, Ruff doesn't enable pycodestyle warnings (`W`) or
|
||||||
|
# McCabe complexity (`C901`) by default.
|
||||||
|
# Enable pydocstyle (`D`) codes by default.
|
||||||
|
select = ["E4", "E7", "E9", "F", "D"]
|
||||||
|
ignore = ["D203", "D213"]
|
||||||
|
|
||||||
|
# Allow fix for all enabled rules (when `--fix`) is provided.
|
||||||
|
fixable = ["ALL"]
|
||||||
|
unfixable = []
|
||||||
|
|
||||||
|
# Allow unused variables when underscore-prefixed.
|
||||||
|
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"
|
||||||
|
|
||||||
|
[format]
|
||||||
|
# Unlike Black, use single quotes for strings.
|
||||||
|
quote-style = "single"
|
||||||
|
|
||||||
|
# Like Black, indent with spaces, rather than tabs.
|
||||||
|
indent-style = "space"
|
||||||
|
|
||||||
|
# Like Black, respect magic trailing commas.
|
||||||
|
skip-magic-trailing-comma = false
|
||||||
|
|
||||||
|
# Like Black, automatically detect the appropriate line ending.
|
||||||
|
line-ending = "auto"
|
||||||
|
|
||||||
|
# Enable auto-formatting of code examples in docstrings. Markdown,
|
||||||
|
# reStructuredText code/literal blocks and doctests are all supported.
|
||||||
|
#
|
||||||
|
# This is currently disabled by default, but it is planned for this
|
||||||
|
# to be opt-out in the future.
|
||||||
|
docstring-code-format = false
|
||||||
|
|
||||||
|
# Set the line length limit used when formatting code snippets in
|
||||||
|
# docstrings.
|
||||||
|
#
|
||||||
|
# This only has an effect when the `docstring-code-format` setting is
|
||||||
|
# enabled.
|
||||||
|
docstring-code-line-length = "dynamic"
|
||||||
3
src/slobs_cli/__about__.py
Normal file
3
src/slobs_cli/__about__.py
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
"""module for package metadata."""
|
||||||
|
|
||||||
|
__version__ = '0.11.5'
|
||||||
@@ -1,9 +1,21 @@
|
|||||||
|
"""Package slobs_cli provides a command-line interface for interacting with SLOBS (Streamlabs OBS)."""
|
||||||
|
|
||||||
from .audio import audio
|
from .audio import audio
|
||||||
from .cli import cli
|
from .cli import cli
|
||||||
from .record import record
|
from .record import record
|
||||||
from .replaybuffer import replaybuffer
|
from .replaybuffer import replaybuffer
|
||||||
from .scene import scene
|
from .scene import scene
|
||||||
|
from .scenecollection import scenecollection
|
||||||
from .stream import stream
|
from .stream import stream
|
||||||
from .studiomode import studiomode
|
from .studiomode import studiomode
|
||||||
|
|
||||||
__all__ = ["cli", "scene", "stream", "record", "audio", "replaybuffer", "studiomode"]
|
__all__ = [
|
||||||
|
'cli',
|
||||||
|
'scene',
|
||||||
|
'stream',
|
||||||
|
'record',
|
||||||
|
'audio',
|
||||||
|
'replaybuffer',
|
||||||
|
'studiomode',
|
||||||
|
'scenecollection',
|
||||||
|
]
|
||||||
|
|||||||
@@ -1,34 +1,67 @@
|
|||||||
|
"""module for managing audio sources in Slobs CLI."""
|
||||||
|
|
||||||
import asyncclick as click
|
import asyncclick as click
|
||||||
from anyio import create_task_group
|
from anyio import create_task_group
|
||||||
from pyslobs import AudioService
|
from pyslobs import AudioService
|
||||||
|
from rich.table import Table
|
||||||
|
from rich.text import Text
|
||||||
|
|
||||||
|
from . import console, util
|
||||||
from .cli import cli
|
from .cli import cli
|
||||||
|
from .errors import SlobsCliError
|
||||||
|
|
||||||
|
|
||||||
@cli.group()
|
@cli.group()
|
||||||
def audio():
|
def audio():
|
||||||
"""Audio management commands."""
|
"""Manage audio sources in Slobs CLI."""
|
||||||
|
|
||||||
|
|
||||||
@audio.command()
|
@audio.command()
|
||||||
|
@click.option('--id', is_flag=True, help='Include audio source IDs in the output.')
|
||||||
@click.pass_context
|
@click.pass_context
|
||||||
async def list(ctx: click.Context):
|
async def list(ctx: click.Context, id: bool = False):
|
||||||
"""List all audio sources."""
|
"""List all audio sources."""
|
||||||
|
conn = ctx.obj['connection']
|
||||||
conn = ctx.obj["connection"]
|
|
||||||
as_ = AudioService(conn)
|
as_ = AudioService(conn)
|
||||||
|
|
||||||
async def _run():
|
async def _run():
|
||||||
sources = await as_.get_sources()
|
sources = await as_.get_sources()
|
||||||
if not sources:
|
if not sources:
|
||||||
|
console.out.print('No audio sources found.')
|
||||||
conn.close()
|
conn.close()
|
||||||
click.Abort(click.style("No audio sources found.", fg="red"))
|
return
|
||||||
|
|
||||||
|
style = ctx.obj['style']
|
||||||
|
table = Table(
|
||||||
|
show_header=True, header_style=style.header, border_style=style.border
|
||||||
|
)
|
||||||
|
|
||||||
|
if id:
|
||||||
|
columns = [
|
||||||
|
('Audio Source Name', 'left'),
|
||||||
|
('Muted', 'center'),
|
||||||
|
('ID', 'left'),
|
||||||
|
]
|
||||||
|
else:
|
||||||
|
columns = [
|
||||||
|
('Audio Source Name', 'left'),
|
||||||
|
('Muted', 'center'),
|
||||||
|
]
|
||||||
|
for heading, justify in columns:
|
||||||
|
table.add_column(Text(heading, justify='center'), justify=justify)
|
||||||
|
|
||||||
for source in sources:
|
for source in sources:
|
||||||
model = await source.get_model()
|
model = await source.get_model()
|
||||||
click.echo(
|
|
||||||
f"Source ID: {source.source_id}, Name: {model.name}, Muted: {model.muted}"
|
to_append = [Text(model.name, style=style.cell)]
|
||||||
)
|
to_append.append(util.check_mark(ctx, model.muted))
|
||||||
|
if id:
|
||||||
|
to_append.append(Text(model.source_id, style=style.cell))
|
||||||
|
|
||||||
|
table.add_row(*to_append)
|
||||||
|
|
||||||
|
console.out.print(table)
|
||||||
|
|
||||||
conn.close()
|
conn.close()
|
||||||
|
|
||||||
async with create_task_group() as tg:
|
async with create_task_group() as tg:
|
||||||
@@ -37,12 +70,11 @@ async def list(ctx: click.Context):
|
|||||||
|
|
||||||
|
|
||||||
@audio.command()
|
@audio.command()
|
||||||
@click.argument("source_name")
|
@click.argument('source_name')
|
||||||
@click.pass_context
|
@click.pass_context
|
||||||
async def mute(ctx: click.Context, source_name: str):
|
async def mute(ctx: click.Context, source_name: str):
|
||||||
"""Mute an audio source by name."""
|
"""Mute an audio source by name."""
|
||||||
|
conn = ctx.obj['connection']
|
||||||
conn = ctx.obj["connection"]
|
|
||||||
as_ = AudioService(conn)
|
as_ = AudioService(conn)
|
||||||
|
|
||||||
async def _run():
|
async def _run():
|
||||||
@@ -51,28 +83,29 @@ async def mute(ctx: click.Context, source_name: str):
|
|||||||
model = await source.get_model()
|
model = await source.get_model()
|
||||||
if model.name.lower() == source_name.lower():
|
if model.name.lower() == source_name.lower():
|
||||||
break
|
break
|
||||||
else:
|
else: # If no source by the given name was found
|
||||||
conn.close()
|
conn.close()
|
||||||
raise click.Abort(
|
raise SlobsCliError(f'Audio source "{source_name}" not found.')
|
||||||
click.style(f"Source '{source_name}' not found.", fg="red")
|
|
||||||
)
|
|
||||||
|
|
||||||
await source.set_muted(True)
|
await source.set_muted(True)
|
||||||
click.echo(f"Muted audio source: {source_name}")
|
console.out.print(f'{console.highlight(ctx, source_name)} muted successfully.')
|
||||||
conn.close()
|
conn.close()
|
||||||
|
|
||||||
async with create_task_group() as tg:
|
try:
|
||||||
tg.start_soon(conn.background_processing)
|
async with create_task_group() as tg:
|
||||||
tg.start_soon(_run)
|
tg.start_soon(conn.background_processing)
|
||||||
|
tg.start_soon(_run)
|
||||||
|
except* SlobsCliError as excgroup:
|
||||||
|
raisable = next(iter(excgroup.exceptions))
|
||||||
|
raise raisable
|
||||||
|
|
||||||
|
|
||||||
@audio.command()
|
@audio.command()
|
||||||
@click.argument("source_name")
|
@click.argument('source_name')
|
||||||
@click.pass_context
|
@click.pass_context
|
||||||
async def unmute(ctx: click.Context, source_name: str):
|
async def unmute(ctx: click.Context, source_name: str):
|
||||||
"""Unmute an audio source by name."""
|
"""Unmute an audio source by name."""
|
||||||
|
conn = ctx.obj['connection']
|
||||||
conn = ctx.obj["connection"]
|
|
||||||
as_ = AudioService(conn)
|
as_ = AudioService(conn)
|
||||||
|
|
||||||
async def _run():
|
async def _run():
|
||||||
@@ -81,28 +114,31 @@ async def unmute(ctx: click.Context, source_name: str):
|
|||||||
model = await source.get_model()
|
model = await source.get_model()
|
||||||
if model.name.lower() == source_name.lower():
|
if model.name.lower() == source_name.lower():
|
||||||
break
|
break
|
||||||
else:
|
else: # If no source by the given name was found
|
||||||
conn.close()
|
conn.close()
|
||||||
raise click.Abort(
|
raise SlobsCliError(f'Audio source "{source_name}" not found.')
|
||||||
click.style(f"Source '{source_name}' not found.", fg="red")
|
|
||||||
)
|
|
||||||
|
|
||||||
await source.set_muted(False)
|
await source.set_muted(False)
|
||||||
click.echo(f"Unmuted audio source: {source_name}")
|
console.out.print(
|
||||||
|
f'{console.highlight(ctx, source_name)} unmuted successfully.'
|
||||||
|
)
|
||||||
conn.close()
|
conn.close()
|
||||||
|
|
||||||
async with create_task_group() as tg:
|
try:
|
||||||
tg.start_soon(conn.background_processing)
|
async with create_task_group() as tg:
|
||||||
tg.start_soon(_run)
|
tg.start_soon(conn.background_processing)
|
||||||
|
tg.start_soon(_run)
|
||||||
|
except* SlobsCliError as excgroup:
|
||||||
|
raisable = next(iter(excgroup.exceptions))
|
||||||
|
raise raisable
|
||||||
|
|
||||||
|
|
||||||
@audio.command()
|
@audio.command()
|
||||||
@click.argument("source_name")
|
@click.argument('source_name')
|
||||||
@click.pass_context
|
@click.pass_context
|
||||||
async def toggle(ctx: click.Context, source_name: str):
|
async def toggle(ctx: click.Context, source_name: str):
|
||||||
"""Toggle mute state of an audio source by name."""
|
"""Toggle mute state of an audio source by name."""
|
||||||
|
conn = ctx.obj['connection']
|
||||||
conn = ctx.obj["connection"]
|
|
||||||
as_ = AudioService(conn)
|
as_ = AudioService(conn)
|
||||||
|
|
||||||
async def _run():
|
async def _run():
|
||||||
@@ -112,18 +148,55 @@ async def toggle(ctx: click.Context, source_name: str):
|
|||||||
if model.name.lower() == source_name.lower():
|
if model.name.lower() == source_name.lower():
|
||||||
if model.muted:
|
if model.muted:
|
||||||
await source.set_muted(False)
|
await source.set_muted(False)
|
||||||
click.echo(f"Unmuted audio source: {source_name}")
|
console.out.print(
|
||||||
|
f'{console.highlight(ctx, source_name)} unmuted successfully.'
|
||||||
|
)
|
||||||
else:
|
else:
|
||||||
await source.set_muted(True)
|
await source.set_muted(True)
|
||||||
click.echo(f"Muted audio source: {source_name}")
|
console.out.print(
|
||||||
|
f'{console.highlight(ctx, source_name)} muted successfully.'
|
||||||
|
)
|
||||||
conn.close()
|
conn.close()
|
||||||
break
|
break
|
||||||
else:
|
else: # If no source by the given name was found
|
||||||
conn.close()
|
conn.close()
|
||||||
raise click.Abort(
|
raise SlobsCliError(f'Audio source "{source_name}" not found.')
|
||||||
click.style(f"Source '{source_name}' not found.", fg="red")
|
|
||||||
)
|
|
||||||
|
|
||||||
async with create_task_group() as tg:
|
try:
|
||||||
tg.start_soon(conn.background_processing)
|
async with create_task_group() as tg:
|
||||||
tg.start_soon(_run)
|
tg.start_soon(conn.background_processing)
|
||||||
|
tg.start_soon(_run)
|
||||||
|
except* SlobsCliError as excgroup:
|
||||||
|
raisable = next(iter(excgroup.exceptions))
|
||||||
|
raise raisable
|
||||||
|
|
||||||
|
|
||||||
|
@audio.command()
|
||||||
|
@click.argument('source_name')
|
||||||
|
@click.pass_context
|
||||||
|
async def status(ctx: click.Context, source_name: str):
|
||||||
|
"""Get the mute status of an audio source by name."""
|
||||||
|
conn = ctx.obj['connection']
|
||||||
|
as_ = AudioService(conn)
|
||||||
|
|
||||||
|
async def _run():
|
||||||
|
sources = await as_.get_sources()
|
||||||
|
for source in sources:
|
||||||
|
model = await source.get_model()
|
||||||
|
if model.name.lower() == source_name.lower():
|
||||||
|
console.out.print(
|
||||||
|
f'{console.highlight(ctx, source_name)} is {"muted" if model.muted else "unmuted"}.'
|
||||||
|
)
|
||||||
|
conn.close()
|
||||||
|
return
|
||||||
|
else: # If no source by the given name was found
|
||||||
|
conn.close()
|
||||||
|
raise SlobsCliError(f'Audio source "{source_name}" not found.')
|
||||||
|
|
||||||
|
try:
|
||||||
|
async with create_task_group() as tg:
|
||||||
|
tg.start_soon(conn.background_processing)
|
||||||
|
tg.start_soon(_run)
|
||||||
|
except* SlobsCliError as excgroup:
|
||||||
|
raisable = next(iter(excgroup.exceptions))
|
||||||
|
raise raisable
|
||||||
|
|||||||
@@ -1,37 +1,81 @@
|
|||||||
|
"""module defining the entry point for the Streamlabs Desktop CLI application."""
|
||||||
|
|
||||||
import anyio
|
import anyio
|
||||||
import asyncclick as click
|
import asyncclick as click
|
||||||
from pyslobs import ConnectionConfig, SlobsConnection
|
from pyslobs import ConnectionConfig, SlobsConnection
|
||||||
|
|
||||||
|
from . import styles
|
||||||
|
from .__about__ import __version__ as version
|
||||||
|
|
||||||
@click.group()
|
|
||||||
@click.option(
|
def validate_style(ctx: click.Context, param: click.Parameter, value: str) -> str:
|
||||||
"-d",
|
"""Validate the style option."""
|
||||||
"--domain",
|
if value not in styles.registry:
|
||||||
default="127.0.0.1",
|
raise click.BadParameter(
|
||||||
show_default=True,
|
f"Invalid style '{value}'. Available styles: {', '.join(styles.registry.keys())}"
|
||||||
show_envvar=True,
|
)
|
||||||
help="The domain of the SLOBS server.",
|
return value
|
||||||
envvar="SLOBS_DOMAIN",
|
|
||||||
|
|
||||||
|
CONTEXT_SETTINGS = dict(help_option_names=['-h', '--help'])
|
||||||
|
|
||||||
|
|
||||||
|
@click.group(
|
||||||
|
context_settings=CONTEXT_SETTINGS,
|
||||||
)
|
)
|
||||||
@click.option(
|
@click.option(
|
||||||
"-p",
|
'-d',
|
||||||
"--port",
|
'--domain',
|
||||||
|
default='localhost',
|
||||||
|
envvar='SLOBS_DOMAIN',
|
||||||
|
show_default=True,
|
||||||
|
show_envvar=True,
|
||||||
|
help='\b\nStreamlabs Desktop WebSocket domain or IP address.\t',
|
||||||
|
)
|
||||||
|
@click.option(
|
||||||
|
'-p',
|
||||||
|
'--port',
|
||||||
default=59650,
|
default=59650,
|
||||||
|
envvar='SLOBS_PORT',
|
||||||
show_default=True,
|
show_default=True,
|
||||||
show_envvar=True,
|
show_envvar=True,
|
||||||
help="The port of the SLOBS server.",
|
help='\b\nStreamlabs Desktop WebSocket port.\t\t\t',
|
||||||
envvar="SLOBS_PORT",
|
|
||||||
)
|
)
|
||||||
@click.option(
|
@click.option(
|
||||||
"-t",
|
'-t',
|
||||||
"--token",
|
'--token',
|
||||||
help="The token for the SLOBS server.",
|
envvar='SLOBS_TOKEN',
|
||||||
envvar="SLOBS_TOKEN",
|
|
||||||
show_envvar=True,
|
show_envvar=True,
|
||||||
required=True,
|
required=True,
|
||||||
|
help='\b\nStreamlabs Desktop WebSocket authentication token.\t',
|
||||||
|
)
|
||||||
|
@click.option(
|
||||||
|
'-s',
|
||||||
|
'--style',
|
||||||
|
default='disabled',
|
||||||
|
envvar='SLOBS_STYLE',
|
||||||
|
show_default=True,
|
||||||
|
show_envvar=True,
|
||||||
|
help='\b\nThe style to use for output.\t\t\t\t',
|
||||||
|
callback=validate_style,
|
||||||
|
)
|
||||||
|
@click.option(
|
||||||
|
'-b',
|
||||||
|
'--no-border',
|
||||||
|
is_flag=True,
|
||||||
|
default=False,
|
||||||
|
envvar='SLOBS_STYLE_NO_BORDER',
|
||||||
|
show_default=True,
|
||||||
|
show_envvar=True,
|
||||||
|
help='\b\nDisable borders in the output.\t\t\t\t',
|
||||||
|
)
|
||||||
|
@click.version_option(
|
||||||
|
version, '-v', '--version', message='%(prog)s version: %(version)s'
|
||||||
)
|
)
|
||||||
@click.pass_context
|
@click.pass_context
|
||||||
async def cli(ctx: click.Context, domain: str, port: int, token: str | None):
|
async def cli(
|
||||||
|
ctx: click.Context, domain: str, port: int, token: str, style: str, no_border: bool
|
||||||
|
):
|
||||||
"""Command line interface for Streamlabs Desktop."""
|
"""Command line interface for Streamlabs Desktop."""
|
||||||
ctx.ensure_object(dict)
|
ctx.ensure_object(dict)
|
||||||
config = ConnectionConfig(
|
config = ConnectionConfig(
|
||||||
@@ -39,7 +83,8 @@ async def cli(ctx: click.Context, domain: str, port: int, token: str | None):
|
|||||||
port=port,
|
port=port,
|
||||||
token=token,
|
token=token,
|
||||||
)
|
)
|
||||||
ctx.obj["connection"] = SlobsConnection(config)
|
ctx.obj['connection'] = SlobsConnection(config)
|
||||||
|
ctx.obj['style'] = styles.request_style_obj(style, no_border)
|
||||||
|
|
||||||
|
|
||||||
def run():
|
def run():
|
||||||
|
|||||||
17
src/slobs_cli/console.py
Normal file
17
src/slobs_cli/console.py
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
"""module for console output handling."""
|
||||||
|
|
||||||
|
import asyncclick as click
|
||||||
|
from rich.console import Console
|
||||||
|
|
||||||
|
out = Console()
|
||||||
|
err = Console(stderr=True, style='bold red')
|
||||||
|
|
||||||
|
|
||||||
|
def highlight(ctx: click.Context, text: str) -> str:
|
||||||
|
"""Highlight text for console output."""
|
||||||
|
return f'[{ctx.obj["style"].highlight}]{text}[/{ctx.obj["style"].highlight}]'
|
||||||
|
|
||||||
|
|
||||||
|
def warning(ctx: click.Context, text: str) -> str:
|
||||||
|
"""Format warning text for console output."""
|
||||||
|
return f'[{ctx.obj["style"].warning}]{text}[/{ctx.obj["style"].warning}]'
|
||||||
46
src/slobs_cli/errors.py
Normal file
46
src/slobs_cli/errors.py
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
"""module for custom exceptions in Slobs CLI."""
|
||||||
|
|
||||||
|
import json
|
||||||
|
|
||||||
|
import asyncclick as click
|
||||||
|
|
||||||
|
from . import console
|
||||||
|
|
||||||
|
|
||||||
|
class SlobsCliError(click.ClickException):
|
||||||
|
"""Base class for all Slobs CLI errors."""
|
||||||
|
|
||||||
|
def __init__(self, message: str):
|
||||||
|
"""Initialize the SlobsCliError with a message."""
|
||||||
|
super().__init__(message)
|
||||||
|
self.exit_code = 1
|
||||||
|
|
||||||
|
def show(self):
|
||||||
|
"""Display the error message in red and write to stderr."""
|
||||||
|
console.err.print(f'Error: {self.message}')
|
||||||
|
|
||||||
|
|
||||||
|
class SlobsCliProtocolError(SlobsCliError):
|
||||||
|
"""Converts pyslobs ProtocolError to a SlobsCliProtocolError."""
|
||||||
|
|
||||||
|
def __init__(self, message: str):
|
||||||
|
"""Initialize the SlobsCliProtocolError with a message."""
|
||||||
|
protocol_message_to_dict = json.loads(
|
||||||
|
str(message).replace('"', '\\"').replace("'", '"')
|
||||||
|
)
|
||||||
|
super().__init__(
|
||||||
|
protocol_message_to_dict.get('message', 'Unable to parse error message')
|
||||||
|
)
|
||||||
|
self.exit_code = 2
|
||||||
|
self.protocol_code = protocol_message_to_dict.get('code', 'Unknown error code')
|
||||||
|
|
||||||
|
def show(self):
|
||||||
|
"""Display the protocol error message in red."""
|
||||||
|
match self.protocol_code:
|
||||||
|
case -32600:
|
||||||
|
console.err.print(
|
||||||
|
'Oops! Looks like we hit a rate limit for this command. Please try again later.'
|
||||||
|
)
|
||||||
|
case _:
|
||||||
|
# Fall back to the base error display for unknown protocol codes
|
||||||
|
super().show()
|
||||||
@@ -1,83 +1,92 @@
|
|||||||
|
"""module for managing recording commands in Slobs CLI."""
|
||||||
|
|
||||||
import asyncclick as click
|
import asyncclick as click
|
||||||
from anyio import create_task_group
|
from anyio import create_task_group
|
||||||
from pyslobs import StreamingService
|
from pyslobs import StreamingService
|
||||||
|
|
||||||
|
from . import console
|
||||||
from .cli import cli
|
from .cli import cli
|
||||||
|
from .errors import SlobsCliError
|
||||||
|
|
||||||
|
|
||||||
@cli.group()
|
@cli.group()
|
||||||
def record():
|
def record():
|
||||||
"""Recording management commands."""
|
"""Manage recording in Slobs CLI."""
|
||||||
|
|
||||||
|
|
||||||
@record.command()
|
@record.command()
|
||||||
@click.pass_context
|
@click.pass_context
|
||||||
async def start(ctx: click.Context):
|
async def start(ctx: click.Context):
|
||||||
"""Start recording."""
|
"""Start recording."""
|
||||||
|
conn = ctx.obj['connection']
|
||||||
conn = ctx.obj["connection"]
|
|
||||||
ss = StreamingService(conn)
|
ss = StreamingService(conn)
|
||||||
|
|
||||||
async def _run():
|
async def _run():
|
||||||
current_state = await ss.get_model()
|
model = await ss.get_model()
|
||||||
active = current_state.recording_status != "offline"
|
active = model.recording_status != 'offline'
|
||||||
|
|
||||||
if active:
|
if active:
|
||||||
conn.close()
|
conn.close()
|
||||||
raise click.Abort(click.style("Recording is already active.", fg="red"))
|
raise SlobsCliError('Recording is already active.')
|
||||||
|
|
||||||
await ss.toggle_recording()
|
await ss.toggle_recording()
|
||||||
click.echo("Recording started.")
|
console.out.print('Recording started.')
|
||||||
|
|
||||||
conn.close()
|
conn.close()
|
||||||
|
|
||||||
async with create_task_group() as tg:
|
try:
|
||||||
tg.start_soon(conn.background_processing)
|
async with create_task_group() as tg:
|
||||||
tg.start_soon(_run)
|
tg.start_soon(conn.background_processing)
|
||||||
|
tg.start_soon(_run)
|
||||||
|
except* SlobsCliError as excgroup:
|
||||||
|
raisable = next(iter(excgroup.exceptions))
|
||||||
|
raise raisable
|
||||||
|
|
||||||
|
|
||||||
@record.command()
|
@record.command()
|
||||||
@click.pass_context
|
@click.pass_context
|
||||||
async def stop(ctx: click.Context):
|
async def stop(ctx: click.Context):
|
||||||
"""Stop recording."""
|
"""Stop recording."""
|
||||||
|
conn = ctx.obj['connection']
|
||||||
conn = ctx.obj["connection"]
|
|
||||||
ss = StreamingService(conn)
|
ss = StreamingService(conn)
|
||||||
|
|
||||||
async def _run():
|
async def _run():
|
||||||
current_state = await ss.get_model()
|
model = await ss.get_model()
|
||||||
active = current_state.recording_status != "offline"
|
active = model.recording_status != 'offline'
|
||||||
|
|
||||||
if not active:
|
if not active:
|
||||||
conn.close()
|
conn.close()
|
||||||
raise click.Abort(click.style("Recording is already inactive.", fg="red"))
|
raise SlobsCliError('Recording is already inactive.')
|
||||||
|
|
||||||
await ss.toggle_recording()
|
await ss.toggle_recording()
|
||||||
click.echo("Recording stopped.")
|
console.out.print('Recording stopped.')
|
||||||
|
|
||||||
conn.close()
|
conn.close()
|
||||||
|
|
||||||
async with create_task_group() as tg:
|
try:
|
||||||
tg.start_soon(conn.background_processing)
|
async with create_task_group() as tg:
|
||||||
tg.start_soon(_run)
|
tg.start_soon(conn.background_processing)
|
||||||
|
tg.start_soon(_run)
|
||||||
|
except* SlobsCliError as excgroup:
|
||||||
|
raisable = next(iter(excgroup.exceptions))
|
||||||
|
raise raisable
|
||||||
|
|
||||||
|
|
||||||
@record.command()
|
@record.command()
|
||||||
@click.pass_context
|
@click.pass_context
|
||||||
async def status(ctx: click.Context):
|
async def status(ctx: click.Context):
|
||||||
"""Get recording status."""
|
"""Get recording status."""
|
||||||
|
conn = ctx.obj['connection']
|
||||||
conn = ctx.obj["connection"]
|
|
||||||
ss = StreamingService(conn)
|
ss = StreamingService(conn)
|
||||||
|
|
||||||
async def _run():
|
async def _run():
|
||||||
current_state = await ss.get_model()
|
model = await ss.get_model()
|
||||||
active = current_state.recording_status != "offline"
|
active = model.recording_status != 'offline'
|
||||||
|
|
||||||
if active:
|
if active:
|
||||||
click.echo("Recording is currently active.")
|
console.out.print('Recording is currently active.')
|
||||||
else:
|
else:
|
||||||
click.echo("Recording is currently inactive.")
|
console.out.print('Recording is currently inactive.')
|
||||||
|
|
||||||
conn.close()
|
conn.close()
|
||||||
|
|
||||||
@@ -90,20 +99,18 @@ async def status(ctx: click.Context):
|
|||||||
@click.pass_context
|
@click.pass_context
|
||||||
async def toggle(ctx: click.Context):
|
async def toggle(ctx: click.Context):
|
||||||
"""Toggle recording status."""
|
"""Toggle recording status."""
|
||||||
|
conn = ctx.obj['connection']
|
||||||
conn = ctx.obj["connection"]
|
|
||||||
ss = StreamingService(conn)
|
ss = StreamingService(conn)
|
||||||
|
|
||||||
async def _run():
|
async def _run():
|
||||||
current_state = await ss.get_model()
|
model = await ss.get_model()
|
||||||
active = current_state.recording_status != "offline"
|
active = model.recording_status != 'offline'
|
||||||
|
|
||||||
|
await ss.toggle_recording()
|
||||||
if active:
|
if active:
|
||||||
await ss.toggle_recording()
|
console.out.print('Recording stopped.')
|
||||||
click.echo("Recording stopped.")
|
|
||||||
else:
|
else:
|
||||||
await ss.toggle_recording()
|
console.out.print('Recording started.')
|
||||||
click.echo("Recording started.")
|
|
||||||
|
|
||||||
conn.close()
|
conn.close()
|
||||||
|
|
||||||
|
|||||||
@@ -1,82 +1,89 @@
|
|||||||
|
"""module for managing the replay buffer in Slobs CLI."""
|
||||||
|
|
||||||
import asyncclick as click
|
import asyncclick as click
|
||||||
from anyio import create_task_group
|
from anyio import create_task_group
|
||||||
from pyslobs import StreamingService
|
from pyslobs import StreamingService
|
||||||
|
|
||||||
|
from . import console
|
||||||
from .cli import cli
|
from .cli import cli
|
||||||
|
from .errors import SlobsCliError
|
||||||
|
|
||||||
|
|
||||||
@cli.group()
|
@cli.group()
|
||||||
def replaybuffer():
|
def replaybuffer():
|
||||||
"""Replay buffer management commands."""
|
"""Manage the replay buffer in Slobs CLI."""
|
||||||
|
|
||||||
|
|
||||||
@replaybuffer.command()
|
@replaybuffer.command()
|
||||||
@click.pass_context
|
@click.pass_context
|
||||||
async def start(ctx: click.Context):
|
async def start(ctx: click.Context):
|
||||||
"""Start the replay buffer."""
|
"""Start the replay buffer."""
|
||||||
|
conn = ctx.obj['connection']
|
||||||
conn = ctx.obj["connection"]
|
|
||||||
ss = StreamingService(conn)
|
ss = StreamingService(conn)
|
||||||
|
|
||||||
async def _run():
|
async def _run():
|
||||||
current_state = await ss.get_model()
|
model = await ss.get_model()
|
||||||
active = current_state.replay_buffer_status != "offline"
|
active = model.replay_buffer_status != 'offline'
|
||||||
|
|
||||||
if active:
|
if active:
|
||||||
conn.close()
|
conn.close()
|
||||||
raise click.Abort(click.style("Replay buffer is already active.", fg="red"))
|
raise SlobsCliError('Replay buffer is already active.')
|
||||||
|
|
||||||
await ss.start_replay_buffer()
|
await ss.start_replay_buffer()
|
||||||
click.echo("Replay buffer started.")
|
console.out.print('Replay buffer started.')
|
||||||
conn.close()
|
conn.close()
|
||||||
|
|
||||||
async with create_task_group() as tg:
|
try:
|
||||||
tg.start_soon(conn.background_processing)
|
async with create_task_group() as tg:
|
||||||
tg.start_soon(_run)
|
tg.start_soon(conn.background_processing)
|
||||||
|
tg.start_soon(_run)
|
||||||
|
except* SlobsCliError as excgroup:
|
||||||
|
raisable = next(iter(excgroup.exceptions))
|
||||||
|
raise raisable
|
||||||
|
|
||||||
|
|
||||||
@replaybuffer.command()
|
@replaybuffer.command()
|
||||||
@click.pass_context
|
@click.pass_context
|
||||||
async def stop(ctx: click.Context):
|
async def stop(ctx: click.Context):
|
||||||
"""Stop the replay buffer."""
|
"""Stop the replay buffer."""
|
||||||
|
conn = ctx.obj['connection']
|
||||||
conn = ctx.obj["connection"]
|
|
||||||
ss = StreamingService(conn)
|
ss = StreamingService(conn)
|
||||||
|
|
||||||
async def _run():
|
async def _run():
|
||||||
current_state = await ss.get_model()
|
model = await ss.get_model()
|
||||||
active = current_state.replay_buffer_status != "offline"
|
active = model.replay_buffer_status != 'offline'
|
||||||
|
|
||||||
if not active:
|
if not active:
|
||||||
conn.close()
|
conn.close()
|
||||||
raise click.Abort(
|
raise SlobsCliError('Replay buffer is already inactive.')
|
||||||
click.style("Replay buffer is already inactive.", fg="red")
|
|
||||||
)
|
|
||||||
|
|
||||||
await ss.stop_replay_buffer()
|
await ss.stop_replay_buffer()
|
||||||
click.echo("Replay buffer stopped.")
|
console.out.print('Replay buffer stopped.')
|
||||||
conn.close()
|
conn.close()
|
||||||
|
|
||||||
async with create_task_group() as tg:
|
try:
|
||||||
tg.start_soon(conn.background_processing)
|
async with create_task_group() as tg:
|
||||||
tg.start_soon(_run)
|
tg.start_soon(conn.background_processing)
|
||||||
|
tg.start_soon(_run)
|
||||||
|
except* SlobsCliError as excgroup:
|
||||||
|
raisable = next(iter(excgroup.exceptions))
|
||||||
|
raise raisable
|
||||||
|
|
||||||
|
|
||||||
@replaybuffer.command()
|
@replaybuffer.command()
|
||||||
@click.pass_context
|
@click.pass_context
|
||||||
async def status(ctx: click.Context):
|
async def status(ctx: click.Context):
|
||||||
"""Get the current status of the replay buffer."""
|
"""Get the current status of the replay buffer."""
|
||||||
|
conn = ctx.obj['connection']
|
||||||
conn = ctx.obj["connection"]
|
|
||||||
ss = StreamingService(conn)
|
ss = StreamingService(conn)
|
||||||
|
|
||||||
async def _run():
|
async def _run():
|
||||||
current_state = await ss.get_model()
|
model = await ss.get_model()
|
||||||
active = current_state.replay_buffer_status != "offline"
|
active = model.replay_buffer_status != 'offline'
|
||||||
if active:
|
if active:
|
||||||
click.echo("Replay buffer is currently active.")
|
console.out.print('Replay buffer is currently active.')
|
||||||
else:
|
else:
|
||||||
click.echo("Replay buffer is currently inactive.")
|
console.out.print('Replay buffer is currently inactive.')
|
||||||
conn.close()
|
conn.close()
|
||||||
|
|
||||||
async with create_task_group() as tg:
|
async with create_task_group() as tg:
|
||||||
@@ -88,13 +95,12 @@ async def status(ctx: click.Context):
|
|||||||
@click.pass_context
|
@click.pass_context
|
||||||
async def save(ctx: click.Context):
|
async def save(ctx: click.Context):
|
||||||
"""Save the current replay buffer."""
|
"""Save the current replay buffer."""
|
||||||
|
conn = ctx.obj['connection']
|
||||||
conn = ctx.obj["connection"]
|
|
||||||
ss = StreamingService(conn)
|
ss = StreamingService(conn)
|
||||||
|
|
||||||
async def _run():
|
async def _run():
|
||||||
await ss.save_replay()
|
await ss.save_replay()
|
||||||
click.echo("Replay buffer saved.")
|
console.out.print('Replay buffer saved.')
|
||||||
conn.close()
|
conn.close()
|
||||||
|
|
||||||
async with create_task_group() as tg:
|
async with create_task_group() as tg:
|
||||||
|
|||||||
@@ -1,75 +1,124 @@
|
|||||||
|
"""module for managing scenes in Slobs CLI."""
|
||||||
|
|
||||||
import asyncclick as click
|
import asyncclick as click
|
||||||
from anyio import create_task_group
|
from anyio import create_task_group
|
||||||
from pyslobs import ScenesService, TransitionsService
|
from pyslobs import ProtocolError, ScenesService, TransitionsService
|
||||||
|
from rich.table import Table
|
||||||
|
from rich.text import Text
|
||||||
|
|
||||||
|
from . import console, util
|
||||||
from .cli import cli
|
from .cli import cli
|
||||||
|
from .errors import SlobsCliError, SlobsCliProtocolError
|
||||||
|
|
||||||
|
|
||||||
@cli.group()
|
@cli.group()
|
||||||
def scene():
|
def scene():
|
||||||
"""Scene management commands."""
|
"""Manage scenes in Slobs CLI."""
|
||||||
|
|
||||||
|
|
||||||
@scene.command()
|
@scene.command()
|
||||||
|
@click.option('--id', is_flag=True, help='Include scene IDs in the output.')
|
||||||
@click.pass_context
|
@click.pass_context
|
||||||
async def list(ctx: click.Context):
|
async def list(ctx: click.Context, id: bool = False):
|
||||||
"""List all available scenes."""
|
"""List all available scenes."""
|
||||||
|
conn = ctx.obj['connection']
|
||||||
conn = ctx.obj["connection"]
|
|
||||||
ss = ScenesService(conn)
|
ss = ScenesService(conn)
|
||||||
|
|
||||||
async def _run():
|
async def _run():
|
||||||
scenes = await ss.get_scenes()
|
scenes = await ss.get_scenes()
|
||||||
if not scenes:
|
if not scenes:
|
||||||
click.echo("No scenes found.")
|
console.out.print('No scenes found.')
|
||||||
|
conn.close()
|
||||||
return
|
return
|
||||||
|
|
||||||
click.echo("Available scenes:")
|
active_scene = await ss.active_scene()
|
||||||
|
|
||||||
|
style = ctx.obj['style']
|
||||||
|
table = Table(
|
||||||
|
show_header=True,
|
||||||
|
header_style=style.header,
|
||||||
|
border_style=style.border,
|
||||||
|
)
|
||||||
|
|
||||||
|
if id:
|
||||||
|
columns = [
|
||||||
|
('Scene Name', 'left'),
|
||||||
|
('Active', 'center'),
|
||||||
|
('ID', 'left'),
|
||||||
|
]
|
||||||
|
else:
|
||||||
|
columns = [
|
||||||
|
('Scene Name', 'left'),
|
||||||
|
('Active', 'center'),
|
||||||
|
]
|
||||||
|
|
||||||
|
for heading, justify in columns:
|
||||||
|
table.add_column(Text(heading, justify='center'), justify=justify)
|
||||||
|
|
||||||
for scene in scenes:
|
for scene in scenes:
|
||||||
click.echo(f"- {click.style(scene.name, fg='blue')} (ID: {scene.id})")
|
to_append = [Text(scene.name, style=style.cell)]
|
||||||
|
to_append.append(
|
||||||
|
util.check_mark(ctx, scene.id == active_scene.id, empty_if_false=True)
|
||||||
|
)
|
||||||
|
if id:
|
||||||
|
to_append.append(Text(scene.id, style=style.cell))
|
||||||
|
|
||||||
|
table.add_row(*to_append)
|
||||||
|
|
||||||
|
console.out.print(table)
|
||||||
|
|
||||||
conn.close()
|
conn.close()
|
||||||
|
|
||||||
async with create_task_group() as tg:
|
try:
|
||||||
tg.start_soon(conn.background_processing)
|
async with create_task_group() as tg:
|
||||||
tg.start_soon(_run)
|
tg.start_soon(conn.background_processing)
|
||||||
|
tg.start_soon(_run)
|
||||||
|
except* ProtocolError as excgroup:
|
||||||
|
p_error = next(iter(excgroup.exceptions))
|
||||||
|
raisable = SlobsCliProtocolError(str(p_error))
|
||||||
|
raise raisable
|
||||||
|
|
||||||
|
|
||||||
@scene.command()
|
@scene.command()
|
||||||
|
@click.option('--id', is_flag=True, help='Include scene IDs in the output.')
|
||||||
@click.pass_context
|
@click.pass_context
|
||||||
async def current(ctx: click.Context):
|
async def current(ctx: click.Context, id: bool = False):
|
||||||
"""Show the currently active scene."""
|
"""Show the currently active scene."""
|
||||||
|
conn = ctx.obj['connection']
|
||||||
conn = ctx.obj["connection"]
|
|
||||||
ss = ScenesService(conn)
|
ss = ScenesService(conn)
|
||||||
|
|
||||||
async def _run():
|
async def _run():
|
||||||
active_scene = await ss.active_scene()
|
active_scene = await ss.active_scene()
|
||||||
if active_scene:
|
console.out.print(
|
||||||
click.echo(
|
f'Current active scene: {console.highlight(ctx, active_scene.name)} '
|
||||||
f"Current active scene: {click.style(active_scene.name, fg='green')} (ID: {active_scene.id})"
|
f'{f"(ID: {console.highlight(ctx, active_scene.id)})" if id else ""}'
|
||||||
)
|
)
|
||||||
else:
|
|
||||||
click.echo("No active scene found.")
|
|
||||||
conn.close()
|
conn.close()
|
||||||
|
|
||||||
async with create_task_group() as tg:
|
try:
|
||||||
tg.start_soon(conn.background_processing)
|
async with create_task_group() as tg:
|
||||||
tg.start_soon(_run)
|
tg.start_soon(conn.background_processing)
|
||||||
|
tg.start_soon(_run)
|
||||||
|
except* ProtocolError as excgroup:
|
||||||
|
p_error = next(iter(excgroup.exceptions))
|
||||||
|
raisable = SlobsCliProtocolError(str(p_error))
|
||||||
|
raise raisable
|
||||||
|
|
||||||
|
|
||||||
@scene.command()
|
@scene.command()
|
||||||
@click.argument("scene_name", type=str)
|
@click.option('--id', is_flag=True, help='Include scene IDs in the output.')
|
||||||
|
@click.argument('scene_name')
|
||||||
@click.option(
|
@click.option(
|
||||||
"--preview",
|
'--preview',
|
||||||
is_flag=True,
|
is_flag=True,
|
||||||
help="Switch the preview scene only.",
|
help='Switch the preview scene only.',
|
||||||
)
|
)
|
||||||
@click.pass_context
|
@click.pass_context
|
||||||
async def switch(ctx: click.Context, scene_name: str, preview: bool = False):
|
async def switch(
|
||||||
|
ctx: click.Context, scene_name: str, preview: bool = False, id: bool = False
|
||||||
|
):
|
||||||
"""Switch to a scene by its name."""
|
"""Switch to a scene by its name."""
|
||||||
|
conn = ctx.obj['connection']
|
||||||
conn = ctx.obj["connection"]
|
|
||||||
ss = ScenesService(conn)
|
ss = ScenesService(conn)
|
||||||
ts = TransitionsService(conn)
|
ts = TransitionsService(conn)
|
||||||
|
|
||||||
@@ -77,41 +126,54 @@ async def switch(ctx: click.Context, scene_name: str, preview: bool = False):
|
|||||||
scenes = await ss.get_scenes()
|
scenes = await ss.get_scenes()
|
||||||
for scene in scenes:
|
for scene in scenes:
|
||||||
if scene.name == scene_name:
|
if scene.name == scene_name:
|
||||||
current_state = await ts.get_model()
|
model = await ts.get_model()
|
||||||
|
|
||||||
if current_state.studio_mode:
|
if model.studio_mode:
|
||||||
await ss.make_scene_active(scene.id)
|
await ss.make_scene_active(scene.id)
|
||||||
if preview:
|
if preview:
|
||||||
click.echo(
|
console.out.print(
|
||||||
f"Switched to scene: {click.style(scene.name, fg='blue')} (ID: {scene.id}) in preview mode."
|
f'Switched to preview scene: {console.highlight(ctx, scene.name)} '
|
||||||
|
f'{f"(ID: {console.highlight(ctx, scene.id)})" if id else ""}'
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
await ts.execute_studio_mode_transition()
|
console.out.print(
|
||||||
click.echo(
|
f'Switched to scene: {console.highlight(ctx, scene.name)} '
|
||||||
f"Switched to scene: {click.style(scene.name, fg='blue')} (ID: {scene.id}) in active mode."
|
f'{f"(ID: {console.highlight(ctx, scene.id)})" if id else ""}'
|
||||||
|
)
|
||||||
|
console.err.print(
|
||||||
|
console.warning(
|
||||||
|
ctx,
|
||||||
|
'Warning: You are in studio mode. The scene switch is not active yet.\n'
|
||||||
|
'use `slobs-cli studiomode force-transition` to activate the scene switch.',
|
||||||
|
)
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
if preview:
|
if preview:
|
||||||
conn.close()
|
conn.close()
|
||||||
raise click.Abort(
|
raise SlobsCliError(
|
||||||
click.style(
|
'Cannot switch the preview scene in non-studio mode.'
|
||||||
"Cannot switch to preview scene in non-studio mode.",
|
|
||||||
fg="red",
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
|
|
||||||
await ss.make_scene_active(scene.id)
|
await ss.make_scene_active(scene.id)
|
||||||
click.echo(
|
console.out.print(
|
||||||
f"Switched to scene: {click.style(scene.name, fg='blue')} (ID: {scene.id}) in active mode."
|
f'Switched to scene: {console.highlight(ctx, scene.name)} '
|
||||||
|
f'{f"(ID: {console.highlight(ctx, scene.id)})" if id else ""}'
|
||||||
)
|
)
|
||||||
break
|
|
||||||
else:
|
|
||||||
conn.close()
|
|
||||||
raise click.ClickException(
|
|
||||||
click.style(f"Scene '{scene_name}' not found.", fg="red")
|
|
||||||
)
|
|
||||||
conn.close()
|
|
||||||
|
|
||||||
async with create_task_group() as tg:
|
conn.close()
|
||||||
tg.start_soon(conn.background_processing)
|
break
|
||||||
tg.start_soon(_run)
|
else: # If no scene by the given name was found
|
||||||
|
conn.close()
|
||||||
|
raise SlobsCliError(f'Scene "{scene_name}" not found.')
|
||||||
|
|
||||||
|
try:
|
||||||
|
async with create_task_group() as tg:
|
||||||
|
tg.start_soon(conn.background_processing)
|
||||||
|
tg.start_soon(_run)
|
||||||
|
except* SlobsCliError as excgroup:
|
||||||
|
raisable = next(iter(excgroup.exceptions))
|
||||||
|
raise raisable
|
||||||
|
except* ProtocolError as excgroup:
|
||||||
|
p_error = next(iter(excgroup.exceptions))
|
||||||
|
raisable = SlobsCliProtocolError(str(p_error))
|
||||||
|
raise raisable
|
||||||
|
|||||||
192
src/slobs_cli/scenecollection.py
Normal file
192
src/slobs_cli/scenecollection.py
Normal file
@@ -0,0 +1,192 @@
|
|||||||
|
"""module for scene collection management in SLOBS CLI."""
|
||||||
|
|
||||||
|
import asyncclick as click
|
||||||
|
from anyio import create_task_group
|
||||||
|
from pyslobs import ISceneCollectionCreateOptions, SceneCollectionsService
|
||||||
|
from rich.table import Table
|
||||||
|
from rich.text import Text
|
||||||
|
|
||||||
|
from . import console, util
|
||||||
|
from .cli import cli
|
||||||
|
from .errors import SlobsCliError
|
||||||
|
|
||||||
|
|
||||||
|
@cli.group()
|
||||||
|
def scenecollection():
|
||||||
|
"""Manage scene collections in Slobs CLI."""
|
||||||
|
|
||||||
|
|
||||||
|
@scenecollection.command()
|
||||||
|
@click.option('--id', is_flag=True, help='Include scene collection IDs in the output.')
|
||||||
|
@click.pass_context
|
||||||
|
async def list(ctx: click.Context, id: bool):
|
||||||
|
"""List all scene collections."""
|
||||||
|
conn = ctx.obj['connection']
|
||||||
|
scs = SceneCollectionsService(conn)
|
||||||
|
|
||||||
|
async def _run():
|
||||||
|
collections = await scs.collections()
|
||||||
|
if not collections:
|
||||||
|
console.out.print('No scene collections found.')
|
||||||
|
conn.close()
|
||||||
|
return
|
||||||
|
|
||||||
|
active_collection = await scs.active_collection()
|
||||||
|
|
||||||
|
style = ctx.obj['style']
|
||||||
|
table = Table(
|
||||||
|
show_header=True,
|
||||||
|
header_style=style.header,
|
||||||
|
border_style=style.border,
|
||||||
|
)
|
||||||
|
|
||||||
|
if id:
|
||||||
|
columns = [
|
||||||
|
('Scene Collection Name', 'left'),
|
||||||
|
('Active', 'center'),
|
||||||
|
('ID', 'left'),
|
||||||
|
]
|
||||||
|
else:
|
||||||
|
columns = [
|
||||||
|
('Scene Collection Name', 'left'),
|
||||||
|
('Active', 'center'),
|
||||||
|
]
|
||||||
|
|
||||||
|
for heading, justify in columns:
|
||||||
|
table.add_column(Text(heading, justify='center'), justify=justify)
|
||||||
|
|
||||||
|
for collection in collections:
|
||||||
|
to_append = [Text(collection.name, style=style.cell)]
|
||||||
|
to_append.append(
|
||||||
|
util.check_mark(
|
||||||
|
ctx, collection.id == active_collection.id, empty_if_false=True
|
||||||
|
)
|
||||||
|
)
|
||||||
|
if id:
|
||||||
|
to_append.append(Text(collection.id, style=style.cell))
|
||||||
|
table.add_row(*to_append)
|
||||||
|
|
||||||
|
console.out.print(table)
|
||||||
|
|
||||||
|
conn.close()
|
||||||
|
|
||||||
|
async with create_task_group() as tg:
|
||||||
|
tg.start_soon(conn.background_processing)
|
||||||
|
tg.start_soon(_run)
|
||||||
|
|
||||||
|
|
||||||
|
@scenecollection.command()
|
||||||
|
@click.argument('scenecollection_name')
|
||||||
|
@click.pass_context
|
||||||
|
async def load(ctx: click.Context, scenecollection_name: str):
|
||||||
|
"""Load a scene collection by name."""
|
||||||
|
conn = ctx.obj['connection']
|
||||||
|
scs = SceneCollectionsService(conn)
|
||||||
|
|
||||||
|
async def _run():
|
||||||
|
collections = await scs.collections()
|
||||||
|
for collection in collections:
|
||||||
|
if collection.name == scenecollection_name:
|
||||||
|
break
|
||||||
|
else: # If no collection by the given name was found
|
||||||
|
conn.close()
|
||||||
|
raise SlobsCliError(f'Scene collection "{scenecollection_name}" not found.')
|
||||||
|
|
||||||
|
await scs.load(collection.id)
|
||||||
|
console.out.print(
|
||||||
|
f'Scene collection {console.highlight(scenecollection_name)} loaded successfully.'
|
||||||
|
)
|
||||||
|
conn.close()
|
||||||
|
|
||||||
|
try:
|
||||||
|
async with create_task_group() as tg:
|
||||||
|
tg.start_soon(conn.background_processing)
|
||||||
|
tg.start_soon(_run)
|
||||||
|
except* SlobsCliError as excgroup:
|
||||||
|
raisable = next(iter(excgroup.exceptions))
|
||||||
|
raise raisable
|
||||||
|
|
||||||
|
|
||||||
|
@scenecollection.command()
|
||||||
|
@click.argument('scenecollection_name')
|
||||||
|
@click.pass_context
|
||||||
|
async def create(ctx: click.Context, scenecollection_name: str):
|
||||||
|
"""Create a new scene collection."""
|
||||||
|
conn = ctx.obj['connection']
|
||||||
|
scs = SceneCollectionsService(conn)
|
||||||
|
|
||||||
|
async def _run():
|
||||||
|
await scs.create(ISceneCollectionCreateOptions(scenecollection_name))
|
||||||
|
console.out.print(
|
||||||
|
f'Scene collection {console.highlight(scenecollection_name)} created successfully.'
|
||||||
|
)
|
||||||
|
conn.close()
|
||||||
|
|
||||||
|
async with create_task_group() as tg:
|
||||||
|
tg.start_soon(conn.background_processing)
|
||||||
|
tg.start_soon(_run)
|
||||||
|
|
||||||
|
|
||||||
|
@scenecollection.command()
|
||||||
|
@click.argument('scenecollection_name')
|
||||||
|
@click.pass_context
|
||||||
|
async def delete(ctx: click.Context, scenecollection_name: str):
|
||||||
|
"""Delete a scene collection by name."""
|
||||||
|
conn = ctx.obj['connection']
|
||||||
|
scs = SceneCollectionsService(conn)
|
||||||
|
|
||||||
|
async def _run():
|
||||||
|
collections = await scs.collections()
|
||||||
|
for collection in collections:
|
||||||
|
if collection.name == scenecollection_name:
|
||||||
|
break
|
||||||
|
else: # If no collection by the given name was found
|
||||||
|
conn.close()
|
||||||
|
raise SlobsCliError(f'Scene collection "{scenecollection_name}" not found.')
|
||||||
|
|
||||||
|
await scs.delete(collection.id)
|
||||||
|
console.out.print(
|
||||||
|
f'Scene collection {console.highlight(scenecollection_name)} deleted successfully.'
|
||||||
|
)
|
||||||
|
conn.close()
|
||||||
|
|
||||||
|
try:
|
||||||
|
async with create_task_group() as tg:
|
||||||
|
tg.start_soon(conn.background_processing)
|
||||||
|
tg.start_soon(_run)
|
||||||
|
except* SlobsCliError as excgroup:
|
||||||
|
raisable = next(iter(excgroup.exceptions))
|
||||||
|
raise raisable
|
||||||
|
|
||||||
|
|
||||||
|
@scenecollection.command()
|
||||||
|
@click.argument('scenecollection_name')
|
||||||
|
@click.argument('new_name')
|
||||||
|
@click.pass_context
|
||||||
|
async def rename(ctx: click.Context, scenecollection_name: str, new_name: str):
|
||||||
|
"""Rename a scene collection."""
|
||||||
|
conn = ctx.obj['connection']
|
||||||
|
scs = SceneCollectionsService(conn)
|
||||||
|
|
||||||
|
async def _run():
|
||||||
|
collections = await scs.collections()
|
||||||
|
for collection in collections:
|
||||||
|
if collection.name == scenecollection_name:
|
||||||
|
break
|
||||||
|
else: # If no collection by the given name was found
|
||||||
|
conn.close()
|
||||||
|
raise SlobsCliError(f'Scene collection "{scenecollection_name}" not found.')
|
||||||
|
|
||||||
|
await scs.rename(new_name, collection.id)
|
||||||
|
console.out.print(
|
||||||
|
f'Scene collection {console.highlight(scenecollection_name)} renamed to {console.highlight(new_name)}.'
|
||||||
|
)
|
||||||
|
conn.close()
|
||||||
|
|
||||||
|
try:
|
||||||
|
async with create_task_group() as tg:
|
||||||
|
tg.start_soon(conn.background_processing)
|
||||||
|
tg.start_soon(_run)
|
||||||
|
except* SlobsCliError as excgroup:
|
||||||
|
raisable = next(iter(excgroup.exceptions))
|
||||||
|
raise raisable
|
||||||
@@ -1,81 +1,90 @@
|
|||||||
|
"""module for managing the replay buffer in Slobs CLI."""
|
||||||
|
|
||||||
import asyncclick as click
|
import asyncclick as click
|
||||||
from anyio import create_task_group
|
from anyio import create_task_group
|
||||||
from pyslobs import StreamingService
|
from pyslobs import StreamingService
|
||||||
|
|
||||||
|
from . import console
|
||||||
from .cli import cli
|
from .cli import cli
|
||||||
|
from .errors import SlobsCliError
|
||||||
|
|
||||||
|
|
||||||
@cli.group()
|
@cli.group()
|
||||||
def stream():
|
def stream():
|
||||||
"""Stream management commands."""
|
"""Manage streaming in Slobs CLI."""
|
||||||
|
|
||||||
|
|
||||||
@stream.command()
|
@stream.command()
|
||||||
@click.pass_context
|
@click.pass_context
|
||||||
async def start(ctx: click.Context):
|
async def start(ctx: click.Context):
|
||||||
"""Start the stream."""
|
"""Start the stream."""
|
||||||
|
conn = ctx.obj['connection']
|
||||||
conn = ctx.obj["connection"]
|
|
||||||
ss = StreamingService(conn)
|
ss = StreamingService(conn)
|
||||||
|
|
||||||
async def _run():
|
async def _run():
|
||||||
current_state = await ss.get_model()
|
model = await ss.get_model()
|
||||||
active = current_state.streaming_status != "offline"
|
active = model.streaming_status != 'offline'
|
||||||
|
|
||||||
if active:
|
if active:
|
||||||
conn.close()
|
conn.close()
|
||||||
raise click.Abort(click.style("Stream is already active.", fg="red"))
|
raise SlobsCliError('Stream is already active.')
|
||||||
|
|
||||||
await ss.toggle_streaming()
|
await ss.toggle_streaming()
|
||||||
click.echo("Stream started.")
|
console.out.print('Stream started.')
|
||||||
conn.close()
|
conn.close()
|
||||||
|
|
||||||
async with create_task_group() as tg:
|
try:
|
||||||
tg.start_soon(conn.background_processing)
|
async with create_task_group() as tg:
|
||||||
tg.start_soon(_run)
|
tg.start_soon(conn.background_processing)
|
||||||
|
tg.start_soon(_run)
|
||||||
|
except* SlobsCliError as excgroup:
|
||||||
|
raisable = next(iter(excgroup.exceptions))
|
||||||
|
raise raisable
|
||||||
|
|
||||||
|
|
||||||
@stream.command()
|
@stream.command()
|
||||||
@click.pass_context
|
@click.pass_context
|
||||||
async def stop(ctx: click.Context):
|
async def stop(ctx: click.Context):
|
||||||
"""Stop the stream."""
|
"""Stop the stream."""
|
||||||
|
conn = ctx.obj['connection']
|
||||||
conn = ctx.obj["connection"]
|
|
||||||
ss = StreamingService(conn)
|
ss = StreamingService(conn)
|
||||||
|
|
||||||
async def _run():
|
async def _run():
|
||||||
current_state = await ss.get_model()
|
model = await ss.get_model()
|
||||||
active = current_state.streaming_status != "offline"
|
active = model.streaming_status != 'offline'
|
||||||
|
|
||||||
if not active:
|
if not active:
|
||||||
conn.close()
|
conn.close()
|
||||||
raise click.Abort(click.style("Stream is already inactive.", fg="red"))
|
raise SlobsCliError('Stream is already inactive.')
|
||||||
|
|
||||||
await ss.toggle_streaming()
|
await ss.toggle_streaming()
|
||||||
click.echo("Stream stopped.")
|
console.out.print('Stream stopped.')
|
||||||
conn.close()
|
conn.close()
|
||||||
|
|
||||||
async with create_task_group() as tg:
|
try:
|
||||||
tg.start_soon(conn.background_processing)
|
async with create_task_group() as tg:
|
||||||
tg.start_soon(_run)
|
tg.start_soon(conn.background_processing)
|
||||||
|
tg.start_soon(_run)
|
||||||
|
except* SlobsCliError as excgroup:
|
||||||
|
raisable = next(iter(excgroup.exceptions))
|
||||||
|
raise raisable
|
||||||
|
|
||||||
|
|
||||||
@stream.command()
|
@stream.command()
|
||||||
@click.pass_context
|
@click.pass_context
|
||||||
async def status(ctx: click.Context):
|
async def status(ctx: click.Context):
|
||||||
"""Get the current stream status."""
|
"""Get the current stream status."""
|
||||||
|
conn = ctx.obj['connection']
|
||||||
conn = ctx.obj["connection"]
|
|
||||||
ss = StreamingService(conn)
|
ss = StreamingService(conn)
|
||||||
|
|
||||||
async def _run():
|
async def _run():
|
||||||
current_state = await ss.get_model()
|
model = await ss.get_model()
|
||||||
active = current_state.streaming_status != "offline"
|
active = model.streaming_status != 'offline'
|
||||||
|
|
||||||
if active:
|
if active:
|
||||||
click.echo("Stream is currently active.")
|
console.out.print('Stream is currently active.')
|
||||||
else:
|
else:
|
||||||
click.echo("Stream is currently inactive.")
|
console.out.print('Stream is currently inactive.')
|
||||||
conn.close()
|
conn.close()
|
||||||
|
|
||||||
async with create_task_group() as tg:
|
async with create_task_group() as tg:
|
||||||
@@ -87,19 +96,18 @@ async def status(ctx: click.Context):
|
|||||||
@click.pass_context
|
@click.pass_context
|
||||||
async def toggle(ctx: click.Context):
|
async def toggle(ctx: click.Context):
|
||||||
"""Toggle the stream status."""
|
"""Toggle the stream status."""
|
||||||
|
conn = ctx.obj['connection']
|
||||||
conn = ctx.obj["connection"]
|
|
||||||
ss = StreamingService(conn)
|
ss = StreamingService(conn)
|
||||||
|
|
||||||
async def _run():
|
async def _run():
|
||||||
current_state = await ss.get_model()
|
model = await ss.get_model()
|
||||||
active = current_state.streaming_status != "offline"
|
active = model.streaming_status != 'offline'
|
||||||
|
|
||||||
await ss.toggle_streaming()
|
await ss.toggle_streaming()
|
||||||
if active:
|
if active:
|
||||||
click.echo("Stream stopped.")
|
console.out.print('Stream stopped.')
|
||||||
else:
|
else:
|
||||||
click.echo("Stream started.")
|
console.out.print('Stream started.')
|
||||||
|
|
||||||
conn.close()
|
conn.close()
|
||||||
|
|
||||||
|
|||||||
@@ -1,75 +1,84 @@
|
|||||||
|
"""module for managing studio mode in Slobs CLI."""
|
||||||
|
|
||||||
import asyncclick as click
|
import asyncclick as click
|
||||||
from anyio import create_task_group
|
from anyio import create_task_group
|
||||||
from pyslobs import TransitionsService
|
from pyslobs import TransitionsService
|
||||||
|
|
||||||
|
from . import console
|
||||||
from .cli import cli
|
from .cli import cli
|
||||||
|
from .errors import SlobsCliError
|
||||||
|
|
||||||
|
|
||||||
@cli.group()
|
@cli.group()
|
||||||
def studiomode():
|
def studiomode():
|
||||||
"""Studio mode management commands."""
|
"""Manage studio mode in Slobs CLI."""
|
||||||
|
|
||||||
|
|
||||||
@studiomode.command()
|
@studiomode.command()
|
||||||
@click.pass_context
|
@click.pass_context
|
||||||
async def enable(ctx: click.Context):
|
async def enable(ctx: click.Context):
|
||||||
"""Enable studio mode."""
|
"""Enable studio mode."""
|
||||||
|
conn = ctx.obj['connection']
|
||||||
conn = ctx.obj["connection"]
|
|
||||||
ts = TransitionsService(conn)
|
ts = TransitionsService(conn)
|
||||||
|
|
||||||
async def _run():
|
async def _run():
|
||||||
current_state = await ts.get_model()
|
model = await ts.get_model()
|
||||||
if current_state.studio_mode:
|
if model.studio_mode:
|
||||||
conn.close()
|
conn.close()
|
||||||
raise click.Abort(click.style("Studio mode is already enabled.", fg="red"))
|
raise SlobsCliError('Studio mode is already enabled.')
|
||||||
|
|
||||||
await ts.enable_studio_mode()
|
await ts.enable_studio_mode()
|
||||||
click.echo("Studio mode enabled successfully.")
|
console.out.print('Studio mode enabled successfully.')
|
||||||
conn.close()
|
conn.close()
|
||||||
|
|
||||||
async with create_task_group() as tg:
|
try:
|
||||||
tg.start_soon(conn.background_processing)
|
async with create_task_group() as tg:
|
||||||
tg.start_soon(_run)
|
tg.start_soon(conn.background_processing)
|
||||||
|
tg.start_soon(_run)
|
||||||
|
except* SlobsCliError as excgroup:
|
||||||
|
raisable = next(iter(excgroup.exceptions))
|
||||||
|
raise raisable
|
||||||
|
|
||||||
|
|
||||||
@studiomode.command()
|
@studiomode.command()
|
||||||
@click.pass_context
|
@click.pass_context
|
||||||
async def disable(ctx: click.Context):
|
async def disable(ctx: click.Context):
|
||||||
"""Disable studio mode."""
|
"""Disable studio mode."""
|
||||||
|
conn = ctx.obj['connection']
|
||||||
conn = ctx.obj["connection"]
|
|
||||||
ts = TransitionsService(conn)
|
ts = TransitionsService(conn)
|
||||||
|
|
||||||
async def _run():
|
async def _run():
|
||||||
current_state = await ts.get_model()
|
model = await ts.get_model()
|
||||||
if not current_state.studio_mode:
|
if not model.studio_mode:
|
||||||
conn.close()
|
conn.close()
|
||||||
raise click.Abort(click.style("Studio mode is already disabled.", fg="red"))
|
raise SlobsCliError('Studio mode is already disabled.')
|
||||||
|
|
||||||
await ts.disable_studio_mode()
|
await ts.disable_studio_mode()
|
||||||
click.echo("Studio mode disabled successfully.")
|
console.out.print('Studio mode disabled successfully.')
|
||||||
conn.close()
|
conn.close()
|
||||||
|
|
||||||
async with create_task_group() as tg:
|
try:
|
||||||
tg.start_soon(conn.background_processing)
|
async with create_task_group() as tg:
|
||||||
tg.start_soon(_run)
|
tg.start_soon(conn.background_processing)
|
||||||
|
tg.start_soon(_run)
|
||||||
|
except* SlobsCliError as excgroup:
|
||||||
|
raisable = next(iter(excgroup.exceptions))
|
||||||
|
raise raisable
|
||||||
|
|
||||||
|
|
||||||
@studiomode.command()
|
@studiomode.command()
|
||||||
@click.pass_context
|
@click.pass_context
|
||||||
async def status(ctx: click.Context):
|
async def status(ctx: click.Context):
|
||||||
"""Check the status of studio mode."""
|
"""Check the status of studio mode."""
|
||||||
|
conn = ctx.obj['connection']
|
||||||
conn = ctx.obj["connection"]
|
|
||||||
ts = TransitionsService(conn)
|
ts = TransitionsService(conn)
|
||||||
|
|
||||||
async def _run():
|
async def _run():
|
||||||
current_state = await ts.get_model()
|
model = await ts.get_model()
|
||||||
if current_state.studio_mode:
|
if model.studio_mode:
|
||||||
click.echo("Studio mode is currently enabled.")
|
console.out.print('Studio mode is currently enabled.')
|
||||||
else:
|
else:
|
||||||
click.echo("Studio mode is currently disabled.")
|
console.out.print('Studio mode is currently disabled.')
|
||||||
conn.close()
|
conn.close()
|
||||||
|
|
||||||
async with create_task_group() as tg:
|
async with create_task_group() as tg:
|
||||||
@@ -81,18 +90,17 @@ async def status(ctx: click.Context):
|
|||||||
@click.pass_context
|
@click.pass_context
|
||||||
async def toggle(ctx: click.Context):
|
async def toggle(ctx: click.Context):
|
||||||
"""Toggle studio mode."""
|
"""Toggle studio mode."""
|
||||||
|
conn = ctx.obj['connection']
|
||||||
conn = ctx.obj["connection"]
|
|
||||||
ts = TransitionsService(conn)
|
ts = TransitionsService(conn)
|
||||||
|
|
||||||
async def _run():
|
async def _run():
|
||||||
current_state = await ts.get_model()
|
model = await ts.get_model()
|
||||||
if current_state.studio_mode:
|
if model.studio_mode:
|
||||||
await ts.disable_studio_mode()
|
await ts.disable_studio_mode()
|
||||||
click.echo("Studio mode disabled successfully.")
|
console.out.print('Studio mode disabled successfully.')
|
||||||
else:
|
else:
|
||||||
await ts.enable_studio_mode()
|
await ts.enable_studio_mode()
|
||||||
click.echo("Studio mode enabled successfully.")
|
console.out.print('Studio mode enabled successfully.')
|
||||||
conn.close()
|
conn.close()
|
||||||
|
|
||||||
async with create_task_group() as tg:
|
async with create_task_group() as tg:
|
||||||
@@ -104,20 +112,23 @@ async def toggle(ctx: click.Context):
|
|||||||
@click.pass_context
|
@click.pass_context
|
||||||
async def force_transition(ctx: click.Context):
|
async def force_transition(ctx: click.Context):
|
||||||
"""Force a transition in studio mode."""
|
"""Force a transition in studio mode."""
|
||||||
|
conn = ctx.obj['connection']
|
||||||
conn = ctx.obj["connection"]
|
|
||||||
ts = TransitionsService(conn)
|
ts = TransitionsService(conn)
|
||||||
|
|
||||||
async def _run():
|
async def _run():
|
||||||
current_state = await ts.get_model()
|
model = await ts.get_model()
|
||||||
if not current_state.studio_mode:
|
if not model.studio_mode:
|
||||||
conn.close()
|
conn.close()
|
||||||
raise click.Abort(click.style("Studio mode is not enabled.", fg="red"))
|
raise SlobsCliError('Studio mode is not enabled.')
|
||||||
|
|
||||||
await ts.execute_studio_mode_transition()
|
await ts.execute_studio_mode_transition()
|
||||||
click.echo("Forced studio mode transition.")
|
console.out.print('Forced studio mode transition.')
|
||||||
conn.close()
|
conn.close()
|
||||||
|
|
||||||
async with create_task_group() as tg:
|
try:
|
||||||
tg.start_soon(conn.background_processing)
|
async with create_task_group() as tg:
|
||||||
tg.start_soon(_run)
|
tg.start_soon(conn.background_processing)
|
||||||
|
tg.start_soon(_run)
|
||||||
|
except* SlobsCliError as excgroup:
|
||||||
|
raisable = next(iter(excgroup.exceptions))
|
||||||
|
raise raisable
|
||||||
|
|||||||
211
src/slobs_cli/styles.py
Normal file
211
src/slobs_cli/styles.py
Normal file
@@ -0,0 +1,211 @@
|
|||||||
|
"""module containing style management for Slobs CLI."""
|
||||||
|
|
||||||
|
import os
|
||||||
|
from dataclasses import dataclass
|
||||||
|
|
||||||
|
registry = {}
|
||||||
|
|
||||||
|
|
||||||
|
def register_style(cls):
|
||||||
|
"""Register a style class."""
|
||||||
|
key = cls.__name__.lower()
|
||||||
|
if key in registry:
|
||||||
|
raise ValueError(f'Style {key} is already registered.')
|
||||||
|
registry[key] = cls
|
||||||
|
return cls
|
||||||
|
|
||||||
|
|
||||||
|
@dataclass
|
||||||
|
class Style:
|
||||||
|
"""Base class for styles."""
|
||||||
|
|
||||||
|
name: str
|
||||||
|
border: str
|
||||||
|
header: str
|
||||||
|
cell: str
|
||||||
|
highlight: str
|
||||||
|
warning: str
|
||||||
|
no_border: bool = False
|
||||||
|
|
||||||
|
def __post_init__(self):
|
||||||
|
"""Post-initialization to set default values and normalize the name."""
|
||||||
|
self.name = self.name.lower()
|
||||||
|
if self.no_border:
|
||||||
|
self.border = None
|
||||||
|
|
||||||
|
|
||||||
|
@register_style
|
||||||
|
@dataclass
|
||||||
|
class Disabled(Style):
|
||||||
|
"""Disabled style."""
|
||||||
|
|
||||||
|
name: str = 'disabled'
|
||||||
|
header: str = ''
|
||||||
|
border: str = 'none'
|
||||||
|
cell: str = 'none'
|
||||||
|
highlight: str = 'none'
|
||||||
|
warning: str = 'none'
|
||||||
|
|
||||||
|
|
||||||
|
@register_style
|
||||||
|
@dataclass
|
||||||
|
class Red(Style):
|
||||||
|
"""Red style."""
|
||||||
|
|
||||||
|
name: str = 'red'
|
||||||
|
header: str = ''
|
||||||
|
border: str = 'dark_red'
|
||||||
|
cell: str = 'red'
|
||||||
|
highlight: str = 'red3'
|
||||||
|
warning: str = 'magenta'
|
||||||
|
|
||||||
|
|
||||||
|
@register_style
|
||||||
|
@dataclass
|
||||||
|
class Magenta(Style):
|
||||||
|
"""Magenta style."""
|
||||||
|
|
||||||
|
name: str = 'magenta'
|
||||||
|
header: str = ''
|
||||||
|
border: str = 'dark_magenta'
|
||||||
|
cell: str = 'magenta'
|
||||||
|
highlight: str = 'magenta3'
|
||||||
|
warning: str = 'magenta'
|
||||||
|
|
||||||
|
|
||||||
|
@register_style
|
||||||
|
@dataclass
|
||||||
|
class Purple(Style):
|
||||||
|
"""Purple style."""
|
||||||
|
|
||||||
|
name: str = 'purple'
|
||||||
|
header: str = ''
|
||||||
|
border: str = 'purple'
|
||||||
|
cell: str = 'medium_orchid'
|
||||||
|
highlight: str = 'medium_orchid'
|
||||||
|
warning: str = 'magenta'
|
||||||
|
|
||||||
|
|
||||||
|
@register_style
|
||||||
|
@dataclass
|
||||||
|
class Blue(Style):
|
||||||
|
"""Blue style."""
|
||||||
|
|
||||||
|
name: str = 'blue'
|
||||||
|
header: str = ''
|
||||||
|
border: str = 'dark_blue'
|
||||||
|
cell: str = 'blue'
|
||||||
|
highlight: str = 'blue3'
|
||||||
|
warning: str = 'magenta'
|
||||||
|
|
||||||
|
|
||||||
|
@register_style
|
||||||
|
@dataclass
|
||||||
|
class Cyan(Style):
|
||||||
|
"""Cyan style."""
|
||||||
|
|
||||||
|
name: str = 'cyan'
|
||||||
|
header: str = ''
|
||||||
|
border: str = 'dark_cyan'
|
||||||
|
cell: str = 'cyan'
|
||||||
|
highlight: str = 'cyan3'
|
||||||
|
warning: str = 'magenta'
|
||||||
|
|
||||||
|
|
||||||
|
@register_style
|
||||||
|
@dataclass
|
||||||
|
class Green(Style):
|
||||||
|
"""Green style."""
|
||||||
|
|
||||||
|
name: str = 'green'
|
||||||
|
header: str = ''
|
||||||
|
border: str = 'dark_green'
|
||||||
|
cell: str = 'green'
|
||||||
|
highlight: str = 'green3'
|
||||||
|
warning: str = 'magenta'
|
||||||
|
|
||||||
|
|
||||||
|
@register_style
|
||||||
|
@dataclass
|
||||||
|
class Yellow(Style):
|
||||||
|
"""Yellow style."""
|
||||||
|
|
||||||
|
name: str = 'yellow'
|
||||||
|
header: str = ''
|
||||||
|
border: str = 'yellow3'
|
||||||
|
cell: str = 'wheat1'
|
||||||
|
highlight: str = 'yellow3'
|
||||||
|
warning: str = 'magenta'
|
||||||
|
|
||||||
|
|
||||||
|
@register_style
|
||||||
|
@dataclass
|
||||||
|
class Orange(Style):
|
||||||
|
"""Orange style."""
|
||||||
|
|
||||||
|
name: str = 'orange'
|
||||||
|
header: str = ''
|
||||||
|
border: str = 'dark_orange'
|
||||||
|
cell: str = 'orange'
|
||||||
|
highlight: str = 'orange3'
|
||||||
|
warning: str = 'magenta'
|
||||||
|
|
||||||
|
|
||||||
|
@register_style
|
||||||
|
@dataclass
|
||||||
|
class White(Style):
|
||||||
|
"""White style."""
|
||||||
|
|
||||||
|
name: str = 'white'
|
||||||
|
header: str = ''
|
||||||
|
border: str = 'white'
|
||||||
|
cell: str = 'white'
|
||||||
|
highlight: str = 'white'
|
||||||
|
warning: str = 'magenta'
|
||||||
|
|
||||||
|
|
||||||
|
@register_style
|
||||||
|
@dataclass
|
||||||
|
class Grey(Style):
|
||||||
|
"""Grey style."""
|
||||||
|
|
||||||
|
name: str = 'grey'
|
||||||
|
header: str = ''
|
||||||
|
border: str = 'grey50'
|
||||||
|
cell: str = 'grey70'
|
||||||
|
highlight: str = 'grey90'
|
||||||
|
warning: str = 'magenta'
|
||||||
|
|
||||||
|
|
||||||
|
@register_style
|
||||||
|
@dataclass
|
||||||
|
class Navy(Style):
|
||||||
|
"""Navy style."""
|
||||||
|
|
||||||
|
name: str = 'navy'
|
||||||
|
header: str = ''
|
||||||
|
border: str = 'deep_sky_blue4'
|
||||||
|
cell: str = 'light_sky_blue3'
|
||||||
|
highlight: str = 'light_sky_blue3'
|
||||||
|
warning: str = 'magenta'
|
||||||
|
|
||||||
|
|
||||||
|
@register_style
|
||||||
|
@dataclass
|
||||||
|
class Black(Style):
|
||||||
|
"""Black style."""
|
||||||
|
|
||||||
|
name: str = 'black'
|
||||||
|
header: str = ''
|
||||||
|
border: str = 'black'
|
||||||
|
cell: str = 'grey30'
|
||||||
|
highlight: str = 'grey30'
|
||||||
|
warning: str = 'magenta'
|
||||||
|
|
||||||
|
|
||||||
|
def request_style_obj(style_name: str, no_border: bool) -> Style:
|
||||||
|
"""Request a style object by name."""
|
||||||
|
if style_name == 'disabled':
|
||||||
|
os.environ['NO_COLOR'] = '1'
|
||||||
|
|
||||||
|
return registry[style_name.lower()](no_border=no_border)
|
||||||
19
src/slobs_cli/util.py
Normal file
19
src/slobs_cli/util.py
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
"""module containing utility functions for Slobs CLI."""
|
||||||
|
|
||||||
|
import os
|
||||||
|
|
||||||
|
import asyncclick as click
|
||||||
|
|
||||||
|
|
||||||
|
def check_mark(ctx: click.Context, value: bool, empty_if_false: bool = False) -> str:
|
||||||
|
"""Return a check mark or cross mark based on the boolean value."""
|
||||||
|
if empty_if_false and not value:
|
||||||
|
return ''
|
||||||
|
|
||||||
|
# rich gracefully handles the absence of colour throughout the rest of the application,
|
||||||
|
# but here we must handle it manually.
|
||||||
|
# If NO_COLOR is set, we return plain text symbols.
|
||||||
|
# Otherwise, we return coloured symbols.
|
||||||
|
if os.getenv('NO_COLOR', '') != '':
|
||||||
|
return '✓' if value else '✗'
|
||||||
|
return '✅' if value else '❌'
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
"""Test suite for the slobs_cli package."""
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
|
"""pytest configuration for async tests using anyio."""
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def anyio_backend():
|
def anyio_backend():
|
||||||
return "asyncio"
|
"""Return the backend to use for async tests."""
|
||||||
|
return 'asyncio'
|
||||||
|
|||||||
41
tests/setup.py
Normal file
41
tests/setup.py
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
"""Create test scenes in Streamlabs.
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
Run this script as a standalone program to setup the test environment.
|
||||||
|
Requires 'SLOBS_DOMAIN' and 'SLOBS_TOKEN' environment variables to be set.
|
||||||
|
"""
|
||||||
|
|
||||||
|
import os
|
||||||
|
|
||||||
|
import anyio
|
||||||
|
from anyio import create_task_group
|
||||||
|
from pyslobs import ConnectionConfig, ScenesService, SlobsConnection
|
||||||
|
|
||||||
|
|
||||||
|
async def setup(conn: SlobsConnection):
|
||||||
|
"""Set up test scenes in Streamlabs OBS."""
|
||||||
|
ss = ScenesService(conn)
|
||||||
|
await ss.create_scene('slobs-test-scene-1')
|
||||||
|
await ss.create_scene('slobs-test-scene-2')
|
||||||
|
await ss.create_scene('slobs-test-scene-3')
|
||||||
|
|
||||||
|
conn.close()
|
||||||
|
|
||||||
|
|
||||||
|
async def main():
|
||||||
|
"""Establish connection and set up scenes."""
|
||||||
|
conn = SlobsConnection(
|
||||||
|
ConnectionConfig(
|
||||||
|
domain=os.environ['SLOBS_DOMAIN'],
|
||||||
|
port=59650,
|
||||||
|
token=os.environ['SLOBS_TOKEN'],
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
async with create_task_group() as tg:
|
||||||
|
tg.start_soon(conn.background_processing)
|
||||||
|
tg.start_soon(setup, conn)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
anyio.run(main)
|
||||||
@@ -1,29 +1,55 @@
|
|||||||
|
"""Remove test scenes in Streamlabs, disable streaming, recording, and replay buffer.
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
Run this script as a standalone program to tear down the test environment.
|
||||||
|
Requires 'SLOBS_DOMAIN' and 'SLOBS_TOKEN' environment variables to be set.
|
||||||
|
"""
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
|
||||||
import anyio
|
import anyio
|
||||||
from anyio import create_task_group
|
from anyio import create_task_group
|
||||||
from pyslobs import ConnectionConfig, SlobsConnection, StreamingService
|
from pyslobs import (
|
||||||
|
ConnectionConfig,
|
||||||
|
ScenesService,
|
||||||
|
SlobsConnection,
|
||||||
|
StreamingService,
|
||||||
|
TransitionsService,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
async def cleanup(conn: SlobsConnection):
|
async def cleanup(conn: SlobsConnection):
|
||||||
|
"""Clean up test scenes and ensure streaming, recording, and replay buffer are stopped."""
|
||||||
|
ss = ScenesService(conn)
|
||||||
|
scenes = await ss.get_scenes()
|
||||||
|
for scene in scenes:
|
||||||
|
if scene.name.startswith('slobs-test-scene-'):
|
||||||
|
await ss.remove_scene(scene.id)
|
||||||
|
|
||||||
ss = StreamingService(conn)
|
ss = StreamingService(conn)
|
||||||
current_state = await ss.get_model()
|
model = await ss.get_model()
|
||||||
if current_state.streaming_status != "offline":
|
if model.streaming_status != 'offline':
|
||||||
await ss.toggle_streaming()
|
await ss.toggle_streaming()
|
||||||
if current_state.replay_buffer_status != "offline":
|
if model.replay_buffer_status != 'offline':
|
||||||
await ss.stop_replay_buffer()
|
await ss.stop_replay_buffer()
|
||||||
if current_state.recording_status != "offline":
|
if model.recording_status != 'offline':
|
||||||
await ss.toggle_recording()
|
await ss.toggle_recording()
|
||||||
|
|
||||||
|
ts = TransitionsService(conn)
|
||||||
|
model = await ts.get_model()
|
||||||
|
if model.studio_mode:
|
||||||
|
await ts.disable_studio_mode()
|
||||||
|
|
||||||
conn.close()
|
conn.close()
|
||||||
|
|
||||||
|
|
||||||
async def main():
|
async def main():
|
||||||
|
"""Establish connection and clean up test scenes."""
|
||||||
conn = SlobsConnection(
|
conn = SlobsConnection(
|
||||||
ConnectionConfig(
|
ConnectionConfig(
|
||||||
domain=os.environ["SLOBS_DOMAIN"],
|
domain=os.environ['SLOBS_DOMAIN'],
|
||||||
port=59650,
|
port=59650,
|
||||||
token=os.environ["SLOBS_TOKEN"],
|
token=os.environ['SLOBS_TOKEN'],
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -32,5 +58,5 @@ async def main():
|
|||||||
tg.start_soon(cleanup, conn)
|
tg.start_soon(cleanup, conn)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == '__main__':
|
||||||
anyio.run(main)
|
anyio.run(main)
|
||||||
|
|||||||
43
tests/test_audio.py
Normal file
43
tests/test_audio.py
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
"""Test cases for audio commands in slobs_cli."""
|
||||||
|
|
||||||
|
import pytest
|
||||||
|
from asyncclick.testing import CliRunner
|
||||||
|
|
||||||
|
from slobs_cli import cli
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.anyio
|
||||||
|
async def test_audio_list():
|
||||||
|
"""Test the list audio sources command."""
|
||||||
|
runner = CliRunner()
|
||||||
|
result = await runner.invoke(cli, ['audio', 'list'])
|
||||||
|
assert result.exit_code == 0
|
||||||
|
assert 'Desktop Audio' in result.output
|
||||||
|
assert 'Mic/Aux' in result.output
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.anyio
|
||||||
|
async def test_audio_mute():
|
||||||
|
"""Test the mute audio source command."""
|
||||||
|
runner = CliRunner()
|
||||||
|
result = await runner.invoke(cli, ['audio', 'mute', 'Mic/Aux'])
|
||||||
|
assert result.exit_code == 0
|
||||||
|
assert 'Mic/Aux muted successfully' in result.output
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.anyio
|
||||||
|
async def test_audio_unmute():
|
||||||
|
"""Test the unmute audio source command."""
|
||||||
|
runner = CliRunner()
|
||||||
|
result = await runner.invoke(cli, ['audio', 'unmute', 'Mic/Aux'])
|
||||||
|
assert result.exit_code == 0
|
||||||
|
assert 'Mic/Aux unmuted successfully' in result.output
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.anyio
|
||||||
|
async def test_audio_invalid_source():
|
||||||
|
"""Test handling of invalid audio source."""
|
||||||
|
runner = CliRunner()
|
||||||
|
result = await runner.invoke(cli, ['audio', 'mute', 'InvalidSource'])
|
||||||
|
assert result.exit_code != 0
|
||||||
|
assert 'Audio source "InvalidSource" not found' in result.output
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
|
"""Test cases for the recording commands of the slobs_cli CLI application."""
|
||||||
|
|
||||||
import anyio
|
import anyio
|
||||||
import asyncclick as click
|
|
||||||
import pytest
|
import pytest
|
||||||
from asyncclick.testing import CliRunner
|
from asyncclick.testing import CliRunner
|
||||||
|
|
||||||
@@ -8,43 +9,35 @@ from slobs_cli import cli
|
|||||||
|
|
||||||
@pytest.mark.anyio
|
@pytest.mark.anyio
|
||||||
async def test_record_start():
|
async def test_record_start():
|
||||||
|
"""Test the start recording command."""
|
||||||
runner = CliRunner()
|
runner = CliRunner()
|
||||||
result = await runner.invoke(cli, ["record", "status"])
|
result = await runner.invoke(cli, ['record', 'status'])
|
||||||
assert result.exit_code == 0
|
assert result.exit_code == 0
|
||||||
active = "Recording is currently active." in result.output
|
active = 'Recording is currently active.' in result.output
|
||||||
|
|
||||||
|
result = await runner.invoke(cli, ['record', 'start'])
|
||||||
if not active:
|
if not active:
|
||||||
result = await runner.invoke(cli, ["record", "start"])
|
|
||||||
assert result.exit_code == 0
|
assert result.exit_code == 0
|
||||||
assert "Recording started" in result.output
|
assert 'Recording started' in result.output
|
||||||
await anyio.sleep(1) # Allow some time for the recording to start
|
await anyio.sleep(0.2) # Allow some time for the recording to start
|
||||||
else:
|
else:
|
||||||
with pytest.raises(ExceptionGroup) as exc_info:
|
assert result.exit_code != 0
|
||||||
result = await runner.invoke(
|
assert 'Recording is already active.' in result.output
|
||||||
cli, ["record", "start"], catch_exceptions=False
|
|
||||||
)
|
|
||||||
assert exc_info.group_contains(
|
|
||||||
click.Abort, match="Recording is already active."
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.anyio
|
@pytest.mark.anyio
|
||||||
async def test_record_stop():
|
async def test_record_stop():
|
||||||
|
"""Test the stop recording command."""
|
||||||
runner = CliRunner()
|
runner = CliRunner()
|
||||||
result = await runner.invoke(cli, ["record", "status"])
|
result = await runner.invoke(cli, ['record', 'status'])
|
||||||
assert result.exit_code == 0
|
assert result.exit_code == 0
|
||||||
active = "Recording is currently active." in result.output
|
active = 'Recording is currently active.' in result.output
|
||||||
|
|
||||||
|
result = await runner.invoke(cli, ['record', 'stop'])
|
||||||
if active:
|
if active:
|
||||||
result = await runner.invoke(cli, ["record", "stop"])
|
|
||||||
assert result.exit_code == 0
|
assert result.exit_code == 0
|
||||||
assert "Recording stopped" in result.output
|
assert 'Recording stopped' in result.output
|
||||||
await anyio.sleep(1) # Allow some time for the recording to stop
|
await anyio.sleep(0.2) # Allow some time for the recording to stop
|
||||||
else:
|
else:
|
||||||
with pytest.raises(ExceptionGroup) as exc_info:
|
assert result.exit_code != 0
|
||||||
result = await runner.invoke(
|
assert 'Recording is already inactive.' in result.output
|
||||||
cli, ["record", "stop"], catch_exceptions=False
|
|
||||||
)
|
|
||||||
assert exc_info.group_contains(
|
|
||||||
click.Abort, match="Recording is already inactive."
|
|
||||||
)
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
|
"""Test cases for the replay buffer commands in slobs_cli."""
|
||||||
|
|
||||||
import anyio
|
import anyio
|
||||||
import asyncclick as click
|
|
||||||
import pytest
|
import pytest
|
||||||
from asyncclick.testing import CliRunner
|
from asyncclick.testing import CliRunner
|
||||||
|
|
||||||
@@ -8,43 +9,35 @@ from slobs_cli import cli
|
|||||||
|
|
||||||
@pytest.mark.anyio
|
@pytest.mark.anyio
|
||||||
async def test_replaybuffer_start():
|
async def test_replaybuffer_start():
|
||||||
|
"""Test the start replay buffer command."""
|
||||||
runner = CliRunner()
|
runner = CliRunner()
|
||||||
result = await runner.invoke(cli, ["replaybuffer", "status"])
|
result = await runner.invoke(cli, ['replaybuffer', 'status'])
|
||||||
assert result.exit_code == 0
|
assert result.exit_code == 0
|
||||||
active = "Replay buffer is currently active." in result.output
|
active = 'Replay buffer is currently active.' in result.output
|
||||||
|
|
||||||
|
result = await runner.invoke(cli, ['replaybuffer', 'start'])
|
||||||
if not active:
|
if not active:
|
||||||
result = await runner.invoke(cli, ["replaybuffer", "start"])
|
|
||||||
assert result.exit_code == 0
|
assert result.exit_code == 0
|
||||||
assert "Replay buffer started" in result.output
|
assert 'Replay buffer started' in result.output
|
||||||
await anyio.sleep(1)
|
await anyio.sleep(0.2) # Allow some time for the replay buffer to start
|
||||||
else:
|
else:
|
||||||
with pytest.raises(ExceptionGroup) as exc_info:
|
assert result.exit_code != 0
|
||||||
result = await runner.invoke(
|
assert 'Replay buffer is already active.' in result.output
|
||||||
cli, ["replaybuffer", "start"], catch_exceptions=False
|
|
||||||
)
|
|
||||||
assert exc_info.group_contains(
|
|
||||||
click.Abort, match="Replay buffer is already active."
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.anyio
|
@pytest.mark.anyio
|
||||||
async def test_replaybuffer_stop():
|
async def test_replaybuffer_stop():
|
||||||
|
"""Test the stop replay buffer command."""
|
||||||
runner = CliRunner()
|
runner = CliRunner()
|
||||||
result = await runner.invoke(cli, ["replaybuffer", "status"])
|
result = await runner.invoke(cli, ['replaybuffer', 'status'])
|
||||||
assert result.exit_code == 0
|
assert result.exit_code == 0
|
||||||
active = "Replay buffer is currently active." in result.output
|
active = 'Replay buffer is currently active.' in result.output
|
||||||
|
|
||||||
|
result = await runner.invoke(cli, ['replaybuffer', 'stop'])
|
||||||
if active:
|
if active:
|
||||||
result = await runner.invoke(cli, ["replaybuffer", "stop"])
|
|
||||||
assert result.exit_code == 0
|
assert result.exit_code == 0
|
||||||
assert "Replay buffer stopped" in result.output
|
assert 'Replay buffer stopped' in result.output
|
||||||
await anyio.sleep(1)
|
await anyio.sleep(0.2) # Allow some time for the replay buffer to stop
|
||||||
else:
|
else:
|
||||||
with pytest.raises(ExceptionGroup) as exc_info:
|
assert result.exit_code != 0
|
||||||
result = await runner.invoke(
|
assert 'Replay buffer is already inactive.' in result.output
|
||||||
cli, ["replaybuffer", "stop"], catch_exceptions=False
|
|
||||||
)
|
|
||||||
assert exc_info.group_contains(
|
|
||||||
click.Abort, match="Replay buffer is already inactive."
|
|
||||||
)
|
|
||||||
|
|||||||
@@ -1,3 +1,6 @@
|
|||||||
|
"""Test cases for scene commands in slobs_cli."""
|
||||||
|
|
||||||
|
import anyio
|
||||||
import pytest
|
import pytest
|
||||||
from asyncclick.testing import CliRunner
|
from asyncclick.testing import CliRunner
|
||||||
|
|
||||||
@@ -6,20 +9,35 @@ from slobs_cli import cli
|
|||||||
|
|
||||||
@pytest.mark.anyio
|
@pytest.mark.anyio
|
||||||
async def test_scene_list():
|
async def test_scene_list():
|
||||||
|
"""Test the list scenes command."""
|
||||||
runner = CliRunner()
|
runner = CliRunner()
|
||||||
result = await runner.invoke(cli, ["scene", "list"])
|
result = await runner.invoke(cli, ['scene', 'list'])
|
||||||
assert result.exit_code == 0
|
assert result.exit_code == 0
|
||||||
assert "slobs-test-scene-1" in result.output
|
assert 'slobs-test-scene-1' in result.output
|
||||||
assert "slobs-test-scene-2" in result.output
|
assert 'slobs-test-scene-2' in result.output
|
||||||
assert "slobs-test-scene-3" in result.output
|
assert 'slobs-test-scene-3' in result.output
|
||||||
|
await anyio.sleep(0.2) # Avoid rate limiting issues
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.anyio
|
@pytest.mark.anyio
|
||||||
async def test_scene_current():
|
async def test_scene_current():
|
||||||
|
"""Test the current scene command."""
|
||||||
runner = CliRunner()
|
runner = CliRunner()
|
||||||
result = await runner.invoke(cli, ["scene", "switch", "slobs-test-scene-2"])
|
result = await runner.invoke(cli, ['scene', 'switch', 'slobs-test-scene-2'])
|
||||||
assert result.exit_code == 0
|
assert result.exit_code == 0
|
||||||
|
await anyio.sleep(0.2) # Avoid rate limiting issues
|
||||||
|
|
||||||
result = await runner.invoke(cli, ["scene", "current"])
|
result = await runner.invoke(cli, ['scene', 'current'])
|
||||||
assert result.exit_code == 0
|
assert result.exit_code == 0
|
||||||
assert "Current active scene: slobs-test-scene-2" in result.output
|
assert 'Current active scene: slobs-test-scene-2' in result.output
|
||||||
|
await anyio.sleep(0.2) # Avoid rate limiting issues
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.anyio
|
||||||
|
async def test_scene_invalid_switch():
|
||||||
|
"""Test switching to an invalid scene."""
|
||||||
|
runner = CliRunner()
|
||||||
|
result = await runner.invoke(cli, ['scene', 'switch', 'invalid-scene'])
|
||||||
|
assert result.exit_code != 0
|
||||||
|
assert 'Scene "invalid-scene" not found' in result.output
|
||||||
|
await anyio.sleep(0.2) # Avoid rate limiting issues
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
|
"""Tests for the stream commands in slobs_cli."""
|
||||||
|
|
||||||
import anyio
|
import anyio
|
||||||
import asyncclick as click
|
|
||||||
import pytest
|
import pytest
|
||||||
from asyncclick.testing import CliRunner
|
from asyncclick.testing import CliRunner
|
||||||
|
|
||||||
@@ -8,39 +9,35 @@ from slobs_cli import cli
|
|||||||
|
|
||||||
@pytest.mark.anyio
|
@pytest.mark.anyio
|
||||||
async def test_stream_start():
|
async def test_stream_start():
|
||||||
|
"""Test the start stream command."""
|
||||||
runner = CliRunner()
|
runner = CliRunner()
|
||||||
result = await runner.invoke(cli, ["stream", "status"])
|
result = await runner.invoke(cli, ['stream', 'status'])
|
||||||
assert result.exit_code == 0
|
assert result.exit_code == 0
|
||||||
active = "Stream is currently active." in result.output
|
active = 'Stream is currently active.' in result.output
|
||||||
|
|
||||||
|
result = await runner.invoke(cli, ['stream', 'start'])
|
||||||
if not active:
|
if not active:
|
||||||
result = await runner.invoke(cli, ["stream", "start"])
|
|
||||||
assert result.exit_code == 0
|
assert result.exit_code == 0
|
||||||
assert "Stream started" in result.output
|
assert 'Stream started' in result.output
|
||||||
await anyio.sleep(1) # Allow some time for the stream to start
|
await anyio.sleep(0.2) # Allow some time for the stream to start
|
||||||
else:
|
else:
|
||||||
with pytest.raises(ExceptionGroup) as exc_info:
|
assert result.exit_code != 0
|
||||||
result = await runner.invoke(
|
assert 'Stream is already active.' in result.output
|
||||||
cli, ["stream", "start"], catch_exceptions=False
|
|
||||||
)
|
|
||||||
assert exc_info.group_contains(click.Abort, match="Stream is already active.")
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.anyio
|
@pytest.mark.anyio
|
||||||
async def test_stream_stop():
|
async def test_stream_stop():
|
||||||
|
"""Test the stop stream command."""
|
||||||
runner = CliRunner()
|
runner = CliRunner()
|
||||||
result = await runner.invoke(cli, ["stream", "status"])
|
result = await runner.invoke(cli, ['stream', 'status'])
|
||||||
assert result.exit_code == 0
|
assert result.exit_code == 0
|
||||||
active = "Stream is currently active." in result.output
|
active = 'Stream is currently active.' in result.output
|
||||||
|
|
||||||
|
result = await runner.invoke(cli, ['stream', 'stop'])
|
||||||
if active:
|
if active:
|
||||||
result = await runner.invoke(cli, ["stream", "stop"])
|
|
||||||
assert result.exit_code == 0
|
assert result.exit_code == 0
|
||||||
assert "Stream stopped" in result.output
|
assert 'Stream stopped' in result.output
|
||||||
await anyio.sleep(1) # Allow some time for the stream to stop
|
await anyio.sleep(0.2) # Allow some time for the stream to stop
|
||||||
else:
|
else:
|
||||||
with pytest.raises(ExceptionGroup) as exc_info:
|
assert result.exit_code != 0
|
||||||
result = await runner.invoke(
|
assert 'Stream is already inactive.' in result.output
|
||||||
cli, ["stream", "stop"], catch_exceptions=False
|
|
||||||
)
|
|
||||||
assert exc_info.group_contains(click.Abort, match="Stream is already inactive.")
|
|
||||||
|
|||||||
60
tests/test_studiomode.py
Normal file
60
tests/test_studiomode.py
Normal file
@@ -0,0 +1,60 @@
|
|||||||
|
"""Test cases for the studio mode commands of the slobs_cli CLI application."""
|
||||||
|
|
||||||
|
import pytest
|
||||||
|
from asyncclick.testing import CliRunner
|
||||||
|
|
||||||
|
from slobs_cli import cli
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.anyio
|
||||||
|
async def test_studiomode_enable():
|
||||||
|
"""Test the enable studio mode command."""
|
||||||
|
runner = CliRunner()
|
||||||
|
|
||||||
|
result = await runner.invoke(cli, ['studiomode', 'status'])
|
||||||
|
assert result.exit_code == 0
|
||||||
|
active = 'Studio mode is currently enabled.' in result.output
|
||||||
|
|
||||||
|
result = await runner.invoke(cli, ['studiomode', 'enable'])
|
||||||
|
if active:
|
||||||
|
assert result.exit_code != 0
|
||||||
|
assert 'Studio mode is already enabled.' in result.output
|
||||||
|
else:
|
||||||
|
assert result.exit_code == 0
|
||||||
|
assert 'Studio mode enabled successfully.' in result.output
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.anyio
|
||||||
|
async def test_studiomode_disable():
|
||||||
|
"""Test the disable studio mode command."""
|
||||||
|
runner = CliRunner()
|
||||||
|
|
||||||
|
result = await runner.invoke(cli, ['studiomode', 'status'])
|
||||||
|
assert result.exit_code == 0
|
||||||
|
active = 'Studio mode is currently enabled.' in result.output
|
||||||
|
|
||||||
|
result = await runner.invoke(cli, ['studiomode', 'disable'])
|
||||||
|
if not active:
|
||||||
|
assert result.exit_code != 0
|
||||||
|
assert 'Studio mode is already disabled.' in result.output
|
||||||
|
else:
|
||||||
|
assert result.exit_code == 0
|
||||||
|
assert 'Studio mode disabled successfully.' in result.output
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.anyio
|
||||||
|
async def test_studiomode_toggle():
|
||||||
|
"""Test the toggle studio mode command."""
|
||||||
|
runner = CliRunner()
|
||||||
|
|
||||||
|
result = await runner.invoke(cli, ['studiomode', 'status'])
|
||||||
|
assert result.exit_code == 0
|
||||||
|
active = 'Studio mode is currently enabled.' in result.output
|
||||||
|
|
||||||
|
result = await runner.invoke(cli, ['studiomode', 'toggle'])
|
||||||
|
if active:
|
||||||
|
assert result.exit_code == 0
|
||||||
|
assert 'Studio mode disabled successfully.' in result.output
|
||||||
|
else:
|
||||||
|
assert result.exit_code == 0
|
||||||
|
assert 'Studio mode enabled successfully.' in result.output
|
||||||
6
tox.ini
6
tox.ini
@@ -1,9 +1,11 @@
|
|||||||
[tox]
|
[tox]
|
||||||
env_list = py{310,311,312}
|
env_list = py{311,312,313}
|
||||||
|
|
||||||
[testenv]
|
[testenv]
|
||||||
passenv = *
|
passenv = *
|
||||||
setenv = VIRTUALENV_DISCOVERY=pyenv
|
setenv = VIRTUALENV_DISCOVERY=pyenv
|
||||||
groups = dev
|
groups = dev
|
||||||
commands =
|
commands =
|
||||||
pytest tests
|
python tests/setup.py
|
||||||
|
pytest tests
|
||||||
|
python tests/teardown.py
|
||||||
Reference in New Issue
Block a user