print separate active/inactive messages

patch bump
This commit is contained in:
onyx-and-iris 2025-06-10 17:00:26 +01:00
parent 7a88b2b6ed
commit c8eb27d188
4 changed files with 103 additions and 11 deletions

87
pdm.lock generated
View File

@ -2,10 +2,10 @@
# It is not intended for manual editing. # It is not intended for manual editing.
[metadata] [metadata]
groups = ["default"] groups = ["default", "test"]
strategy = ["inherit_metadata"] strategy = ["inherit_metadata"]
lock_version = "4.5.0" lock_version = "4.5.0"
content_hash = "sha256:eae45ee2529a0e43273824676782883a88820d9cae2917091b71cdbcfbf003f8" content_hash = "sha256:650186f9e935750e247c5ec3d8981e063b0cd80e2d22d4e73e70b1e168a8f16b"
[[metadata.targets]] [[metadata.targets]]
requires_python = ">=3.12" requires_python = ">=3.12"
@ -48,8 +48,8 @@ name = "colorama"
version = "0.4.6" version = "0.4.6"
requires_python = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*,>=2.7" requires_python = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*,>=2.7"
summary = "Cross-platform colored terminal text." summary = "Cross-platform colored terminal text."
groups = ["default"] groups = ["default", "test"]
marker = "platform_system == \"Windows\"" marker = "platform_system == \"Windows\" or sys_platform == \"win32\""
files = [ files = [
{file = "colorama-0.4.6-py2.py3-none-any.whl", hash = "sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6"}, {file = "colorama-0.4.6-py2.py3-none-any.whl", hash = "sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6"},
{file = "colorama-0.4.6.tar.gz", hash = "sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44"}, {file = "colorama-0.4.6.tar.gz", hash = "sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44"},
@ -66,6 +66,50 @@ files = [
{file = "idna-3.10.tar.gz", hash = "sha256:12f65c9b470abda6dc35cf8e63cc574b1c52b11df2c86030af0ac09b01b13ea9"}, {file = "idna-3.10.tar.gz", hash = "sha256:12f65c9b470abda6dc35cf8e63cc574b1c52b11df2c86030af0ac09b01b13ea9"},
] ]
[[package]]
name = "iniconfig"
version = "2.1.0"
requires_python = ">=3.8"
summary = "brain-dead simple config-ini parsing"
groups = ["test"]
files = [
{file = "iniconfig-2.1.0-py3-none-any.whl", hash = "sha256:9deba5723312380e77435581c6bf4935c94cbfab9b1ed33ef8d238ea168eb760"},
{file = "iniconfig-2.1.0.tar.gz", hash = "sha256:3abbd2e30b36733fee78f9c7f7308f2d0050e88f0087fd25c2645f63c773e1c7"},
]
[[package]]
name = "packaging"
version = "25.0"
requires_python = ">=3.8"
summary = "Core utilities for Python packages"
groups = ["test"]
files = [
{file = "packaging-25.0-py3-none-any.whl", hash = "sha256:29572ef2b1f17581046b3a2227d5c611fb25ec70ca1ba8554b24b0e69331a484"},
{file = "packaging-25.0.tar.gz", hash = "sha256:d443872c98d677bf60f6a1f2f8c1cb748e8fe762d2bf9d3148b5599295b0fc4f"},
]
[[package]]
name = "pluggy"
version = "1.6.0"
requires_python = ">=3.9"
summary = "plugin and hook calling mechanisms for python"
groups = ["test"]
files = [
{file = "pluggy-1.6.0-py3-none-any.whl", hash = "sha256:e920276dd6813095e9377c0bc5566d94c932c33b27a3e3945d8389c374dd4746"},
{file = "pluggy-1.6.0.tar.gz", hash = "sha256:7dcc130b76258d33b90f61b658791dede3486c3e6bfb003ee5c9bfb396dd22f3"},
]
[[package]]
name = "pygments"
version = "2.19.1"
requires_python = ">=3.8"
summary = "Pygments is a syntax highlighting package written in Python."
groups = ["test"]
files = [
{file = "pygments-2.19.1-py3-none-any.whl", hash = "sha256:9ea1544ad55cecf4b8242fab6dd35a93bbce657034b0611ee383099054ab6d8c"},
{file = "pygments-2.19.1.tar.gz", hash = "sha256:61c16d2a8576dc0649d9f39e089b5f02bcd27fba10d8fb4dcc28173f7a45151f"},
]
[[package]] [[package]]
name = "pyslobs" name = "pyslobs"
version = "2.0.4" version = "2.0.4"
@ -80,6 +124,41 @@ files = [
{file = "pyslobs-2.0.4.tar.gz", hash = "sha256:a1e855b62cf4dd1208131fd58d925022dde8f057e33a0cb4933fd55efee876c7"}, {file = "pyslobs-2.0.4.tar.gz", hash = "sha256:a1e855b62cf4dd1208131fd58d925022dde8f057e33a0cb4933fd55efee876c7"},
] ]
[[package]]
name = "pytest"
version = "8.4.0"
requires_python = ">=3.9"
summary = "pytest: simple powerful testing with Python"
groups = ["test"]
dependencies = [
"colorama>=0.4; sys_platform == \"win32\"",
"exceptiongroup>=1; python_version < \"3.11\"",
"iniconfig>=1",
"packaging>=20",
"pluggy<2,>=1.5",
"pygments>=2.7.2",
"tomli>=1; python_version < \"3.11\"",
]
files = [
{file = "pytest-8.4.0-py3-none-any.whl", hash = "sha256:f40f825768ad76c0977cbacdf1fd37c6f7a468e460ea6a0636078f8972d4517e"},
{file = "pytest-8.4.0.tar.gz", hash = "sha256:14d920b48472ea0dbf68e45b96cd1ffda4705f33307dcc86c676c1b5104838a6"},
]
[[package]]
name = "pytest-randomly"
version = "3.16.0"
requires_python = ">=3.9"
summary = "Pytest plugin to randomly order tests and control random.seed."
groups = ["test"]
dependencies = [
"importlib-metadata>=3.6; python_version < \"3.10\"",
"pytest",
]
files = [
{file = "pytest_randomly-3.16.0-py3-none-any.whl", hash = "sha256:8633d332635a1a0983d3bba19342196807f6afb17c3eef78e02c2f85dade45d6"},
{file = "pytest_randomly-3.16.0.tar.gz", hash = "sha256:11bf4d23a26484de7860d82f726c0629837cf4064b79157bd18ec9d41d7feb26"},
]
[[package]] [[package]]
name = "sniffio" name = "sniffio"
version = "1.3.1" version = "1.3.1"

View File

@ -1,6 +1,6 @@
[project] [project]
name = "slobs-cli" name = "slobs-cli"
version = "0.6.0" version = "0.6.1"
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 = ["pyslobs>=2.0.4", "asyncclick>=8.1.8"]
@ -22,3 +22,10 @@ distribution = true
[tool.pdm.scripts] [tool.pdm.scripts]
cli.cmd = "slobs-cli {args}" cli.cmd = "slobs-cli {args}"
cli.env_file = ".env" cli.env_file = ".env"
test.cmd = "pytest {args}"
test.env_file = ".env"
post_test.cmd = "python tests/teardown.py"
[dependency-groups]
test = ["pytest>=8.4.0", "pytest-randomly>=3.16.0"]

View File

@ -72,8 +72,11 @@ async def status(ctx: click.Context):
async def _run(): async def _run():
current_state = await ss.get_model() current_state = await ss.get_model()
status = current_state.replay_buffer_status active = current_state.replay_buffer_status != "offline"
click.echo(f"Replay buffer status: {status}") if active:
click.echo("Replay buffer is currently active.")
else:
click.echo("Replay buffer is currently inactive.")
conn.close() conn.close()
async with create_task_group() as tg: async with create_task_group() as tg:

View File

@ -70,8 +70,12 @@ async def status(ctx: click.Context):
async def _run(): async def _run():
current_state = await ss.get_model() current_state = await ss.get_model()
status = current_state.streaming_status active = current_state.streaming_status != "offline"
click.echo(f"Current stream status: {status}")
if active:
click.echo("Stream is currently active.")
else:
click.echo("Stream is currently inactive.")
conn.close() conn.close()
async with create_task_group() as tg: async with create_task_group() as tg:
@ -91,11 +95,10 @@ async def toggle(ctx: click.Context):
current_state = await ss.get_model() current_state = await ss.get_model()
active = current_state.streaming_status != "offline" active = current_state.streaming_status != "offline"
if active:
await ss.toggle_streaming() await ss.toggle_streaming()
if active:
click.echo("Stream stopped.") click.echo("Stream stopped.")
else: else:
await ss.toggle_streaming()
click.echo("Stream started.") click.echo("Stream started.")
conn.close() conn.close()