record stop now prints the the output path of the recording

added record directory command

record unit test updated

README updated

minor bump
This commit is contained in:
onyx-and-iris 2025-05-27 01:20:35 +01:00
parent ca0f01ef79
commit e7d9deba71
4 changed files with 44 additions and 4 deletions

View File

@ -324,6 +324,19 @@ obsws-cli record resume
obsws-cli record pause obsws-cli record pause
``` ```
- directory: Get or set the recording directory.
*optional*
- args: <record_directory>
- if not passed the current record directory will be printed.
```console
obsws-cli record directory
obsws-cli record directory "/home/me/obs-vids/"
obsws-cli record directory "C:/Users/me/Videos"
```
#### Stream #### Stream
- start: Start streaming. - start: Start streaming.

View File

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

View File

@ -1,5 +1,8 @@
"""module for controlling OBS recording functionality.""" """module for controlling OBS recording functionality."""
from pathlib import Path
from typing import Annotated, Optional
import typer import typer
from rich.console import Console from rich.console import Console
@ -45,8 +48,8 @@ def stop(ctx: typer.Context):
err_console.print('Recording is not in progress, cannot stop.') err_console.print('Recording is not in progress, cannot stop.')
raise typer.Exit(1) raise typer.Exit(1)
ctx.obj.stop_record() resp = ctx.obj.stop_record()
out_console.print('Recording stopped successfully.') out_console.print(f'Recording stopped successfully. Saved to: {resp.output_path}')
@app.command('toggle | tg') @app.command('toggle | tg')
@ -100,3 +103,27 @@ def pause(ctx: typer.Context):
ctx.obj.pause_record() ctx.obj.pause_record()
out_console.print('Recording paused successfully.') out_console.print('Recording paused successfully.')
@app.command('directory | d')
def directory(
ctx: typer.Context,
record_directory: Annotated[
Optional[Path],
# Since the CLI and OBS may be running on different platforms,
# we won't validate the path here.
typer.Argument(
file_okay=False,
dir_okay=True,
help='Directory to set for recording.',
),
] = None,
):
"""Get or set the recording directory."""
if record_directory is not None:
ctx.obj.set_record_directory(str(record_directory))
out_console.print(f'Recording directory updated to: {record_directory}')
else:
out_console.print(
f'Recording directory: {ctx.obj.get_record_directory().record_directory}'
)

View File

@ -23,7 +23,7 @@ def test_record_start_status_stop():
result = runner.invoke(app, ['record', 'stop']) result = runner.invoke(app, ['record', 'stop'])
assert result.exit_code == 0 assert result.exit_code == 0
assert 'Recording stopped successfully.' in result.stdout assert 'Recording stopped successfully. Saved to:' in result.stdout
time.sleep(0.5) # Wait for the recording to stop time.sleep(0.5) # Wait for the recording to stop