Compare commits

...

4 Commits

Author SHA1 Message Date
e8b699cba6 add output to studiomode enable/disable comands
upd studiomode unit tests
2025-05-08 01:15:52 +01:00
4f0a3816ba upd group toggle test 2025-05-08 00:39:06 +01:00
02614cd33c set scene colletion to default at end of test 2025-05-07 23:26:09 +01:00
4a41239e50 update toggle commands
add toggle record/toggle stream tests

pre-release patch bump
2025-05-07 19:43:32 +01:00
10 changed files with 78 additions and 24 deletions

View File

@ -1,4 +1,4 @@
# SPDX-FileCopyrightText: 2025-present onyx-and-iris <code@onyxandiris.online>
#
# SPDX-License-Identifier: MIT
__version__ = "0.10.2"
__version__ = "0.10.3a0"

View File

@ -46,6 +46,16 @@ def stop(ctx: typer.Context):
typer.echo('Recording stopped successfully.')
@app.command('toggle | tg')
def toggle(ctx: typer.Context):
"""Toggle recording."""
resp = ctx.obj.toggle_record()
if resp.output_active:
type.echo('Recording started successfully.')
else:
type.echo('Recording stopped successfully.')
@app.command('status | ss')
def status(ctx: typer.Context):
"""Get recording status."""
@ -59,16 +69,6 @@ def status(ctx: typer.Context):
typer.echo('Recording is not in progress.')
@app.command('toggle | tg')
def toggle(ctx: typer.Context):
"""Toggle recording."""
active, _ = _get_recording_status(ctx)
if active:
ctx.invoke(stop, ctx=ctx)
else:
ctx.invoke(start, ctx=ctx)
@app.command('resume | r')
def resume(ctx: typer.Context):
"""Resume recording."""

View File

@ -26,6 +26,16 @@ def stop(ctx: typer.Context):
typer.echo('Replay buffer stopped.')
@app.command('toggle | tg')
def toggle(ctx: typer.Context):
"""Toggle the replay buffer."""
resp = ctx.obj.toggle_replay_buffer()
if resp.output_active:
typer.echo('Replay buffer is active.')
else:
typer.echo('Replay buffer is not active.')
@app.command('status | ss')
def status(ctx: typer.Context):
"""Get the status of the replay buffer."""

View File

@ -42,6 +42,16 @@ def stop(ctx: typer.Context):
typer.echo('Streaming stopped successfully.')
@app.command('toggle | tg')
def toggle(ctx: typer.Context):
"""Toggle streaming."""
resp = ctx.obj.toggle_stream()
if resp.output_active:
typer.echo('Streaming started successfully.')
else:
typer.echo('Streaming stopped successfully.')
@app.command('status | ss')
def status(ctx: typer.Context):
"""Get streaming status."""
@ -64,13 +74,3 @@ def status(ctx: typer.Context):
typer.echo('Streaming is in progress.')
else:
typer.echo('Streaming is not in progress.')
@app.command('toggle | tg')
def toggle(ctx: typer.Context):
"""Toggle streaming."""
active, _ = _get_streaming_status(ctx)
if active:
ctx.invoke(stop, ctx=ctx)
else:
ctx.invoke(start, ctx=ctx)

View File

@ -16,12 +16,14 @@ def main():
def enable(ctx: typer.Context):
"""Enable studio mode."""
ctx.obj.set_studio_mode_enabled(True)
typer.echo('Studio mode has been enabled.')
@app.command('disable | off')
def disable(ctx: typer.Context):
"""Disable studio mode."""
ctx.obj.set_studio_mode_enabled(False)
typer.echo('Studio mode has been disabled.')
@app.command('toggle | tg')

View File

@ -90,11 +90,16 @@ def pytest_sessionfinish(session, exitstatus):
Return the exit status to the system.
"""
session.obsws.remove_scene('pytest')
session.obsws.set_current_scene_collection('default')
resp = session.obsws.get_stream_status()
if resp.output_active:
session.obsws.stop_stream()
resp = session.obsws.get_record_status()
if resp.output_active:
session.obsws.stop_record()
# Close the OBS WebSocket client connection
session.obsws.disconnect()

View File

@ -23,12 +23,15 @@ def test_group_show():
def test_group_toggle():
"""Test the group toggle command."""
result = runner.invoke(app, ['group', 'hide', 'Scene', 'test_group'])
result = runner.invoke(app, ['group', 'status', 'Scene', 'test_group'])
assert result.exit_code == 0
assert "Group 'test_group' is now hidden." in result.stdout
enabled = "Group 'test_group' is now visible." in result.stdout
result = runner.invoke(app, ['group', 'toggle', 'Scene', 'test_group'])
assert result.exit_code == 0
if enabled:
assert "Group 'test_group' is now hidden." in result.stdout
else:
assert "Group 'test_group' is now visible." in result.stdout

View File

@ -30,3 +30,18 @@ def test_record_start_status_stop():
result = runner.invoke(app, ['record', 'status'])
assert result.exit_code == 0
assert 'Recording is not in progress.' in result.stdout
def test_record_toggle():
"""Test the record toggle command."""
result = runner.invoke(app, ['record', 'status'])
assert result.exit_code == 0
active = 'Recording is in progress.' in result.stdout
result = runner.invoke(app, ['record', 'toggle'])
assert result.exit_code == 0
time.sleep(0.5) # Wait for the recording to toggle
if active:
assert 'Recording stopped successfully.' in result.stdout
else:
assert 'Recording started successfully.' in result.stdout

View File

@ -41,3 +41,20 @@ def test_stream_stop():
assert 'Streaming stopped successfully.' in result.stdout
else:
assert 'Streaming is not in progress, cannot stop.' in result.stdout
def test_stream_toggle():
"""Test the stream toggle command."""
result = runner.invoke(app, ['stream', 'status'])
assert result.exit_code == 0
active = 'Streaming is in progress' in result.stdout
result = runner.invoke(app, ['stream', 'toggle'])
assert result.exit_code == 0
time.sleep(2) # Wait for the stream to toggle
if active:
assert 'Streaming stopped successfully.' in result.stdout
else:
assert 'Streaming started successfully.' in result.stdout

View File

@ -11,6 +11,7 @@ def test_studio_enable():
"""Test the studio enable command."""
result = runner.invoke(app, ['studiomode', 'enable'])
assert result.exit_code == 0
assert 'Studio mode has been enabled.' in result.stdout
result = runner.invoke(app, ['studiomode', 'status'])
assert result.exit_code == 0
@ -21,6 +22,7 @@ def test_studio_disable():
"""Test the studio disable command."""
result = runner.invoke(app, ['studiomode', 'disable'])
assert result.exit_code == 0
assert 'Studio mode has been disabled.' in result.stdout
result = runner.invoke(app, ['studiomode', 'status'])
assert result.exit_code == 0