Compare commits

...

3 Commits

Author SHA1 Message Date
306f19eeae add 0.8.0 to CHANGELOG 2025-05-27 01:28:14 +01:00
43dd77ffdc record directory added to README 2025-05-27 01:27:50 +01:00
f94ac1ca0c record stop now prints output path of recording
record directory command added
2025-05-27 01:27:30 +01:00
4 changed files with 63 additions and 9 deletions

View File

@ -5,6 +5,16 @@ 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/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
# [0.8.0] - 2025-05-27
### Added
- record directory command, see [directory under RecordCmd](https://github.com/onyx-and-iris/gobs-cli?tab=readme-ov-file#recordcmd)
### Changed
- record stop now prints the output path of the recording.
# [0.7.0] - 2025-05-26

View File

@ -281,6 +281,19 @@ gobs-cli record pause
gobs-cli record resume
```
- directory: Get/Set recording directory.
*optional*
- args: RecordDirectory
- if not passed the current record directory will be printed.
```console
gobs-cli record directory
gobs-cli record directory "/home/me/obs-vids/"
gobs-cli record directory "C:/Users/me/Videos"
```
### StreamCmd
- start: Start streaming.

View File

@ -2,16 +2,19 @@ package main
import (
"fmt"
"github.com/andreykaipov/goobs/api/requests/config"
)
// RecordCmd handles the recording commands.
type RecordCmd struct {
Start RecordStartCmd `cmd:"" help:"Start recording." aliases:"s"`
Stop RecordStopCmd `cmd:"" help:"Stop recording." aliases:"st"`
Toggle RecordToggleCmd `cmd:"" help:"Toggle recording." aliases:"tg"`
Status RecordStatusCmd `cmd:"" help:"Show recording status." aliases:"ss"`
Pause RecordPauseCmd `cmd:"" help:"Pause recording." aliases:"p"`
Resume RecordResumeCmd `cmd:"" help:"Resume recording." aliases:"r"`
Start RecordStartCmd `cmd:"" help:"Start recording." aliases:"s"`
Stop RecordStopCmd `cmd:"" help:"Stop recording." aliases:"st"`
Toggle RecordToggleCmd `cmd:"" help:"Toggle recording." aliases:"tg"`
Status RecordStatusCmd `cmd:"" help:"Show recording status." aliases:"ss"`
Pause RecordPauseCmd `cmd:"" help:"Pause recording." aliases:"p"`
Resume RecordResumeCmd `cmd:"" help:"Resume recording." aliases:"r"`
Directory RecordDirectoryCmd `cmd:"" help:"Get/Set recording directory." aliases:"d"`
}
// RecordStartCmd starts the recording.
@ -32,11 +35,11 @@ type RecordStopCmd struct{} // size = 0x0
// Run executes the command to stop recording.
func (cmd *RecordStopCmd) Run(ctx *context) error {
_, err := ctx.Client.Record.StopRecord()
resp, err := ctx.Client.Record.StopRecord()
if err != nil {
return err
}
fmt.Fprintln(ctx.Out, "Recording stopped successfully.")
fmt.Fprintf(ctx.Out, "%s", fmt.Sprintf("Recording stopped successfully. Output file: %s\n", resp.OutputPath))
return nil
}
@ -132,3 +135,30 @@ func (cmd *RecordResumeCmd) Run(ctx *context) error {
fmt.Fprintln(ctx.Out, "Recording resumed successfully.")
return nil
}
// RecordDirectoryCmd sets the recording directory.
type RecordDirectoryCmd struct {
RecordDirectory string `arg:"" help:"Directory to save recordings." default:""`
}
// Run executes the command to set the recording directory.
func (cmd *RecordDirectoryCmd) Run(ctx *context) error {
if cmd.RecordDirectory == "" {
resp, err := ctx.Client.Config.GetRecordDirectory()
if err != nil {
return err
}
fmt.Fprintf(ctx.Out, "Current recording directory: %s\n", resp.RecordDirectory)
return nil
}
_, err := ctx.Client.Config.SetRecordDirectory(
config.NewSetRecordDirectoryParams().WithRecordDirectory(cmd.RecordDirectory),
)
if err != nil {
return err
}
fmt.Fprintf(ctx.Out, "Recording directory set to: %s\n", cmd.RecordDirectory)
return nil
}

View File

@ -2,6 +2,7 @@ package main
import (
"bytes"
"strings"
"testing"
"time"
)
@ -45,7 +46,7 @@ func TestRecordStartStatusStop(t *testing.T) {
if err != nil {
t.Fatalf("Failed to stop recording: %v", err)
}
if out.String() != "Recording stopped successfully.\n" {
if !strings.Contains(out.String(), "Recording stopped successfully. Output file:") {
t.Fatalf("Expected output to be 'Recording stopped successfully.', got '%s'", out.String())
}
// Reset output buffer for the next command