Compare commits

..

No commits in common. "306f19eeae497d3d8d7d3d85cd509727e516fcf2" and "c27a5ea6c5898046d792c7b52097f9d10ef47527" have entirely different histories.

4 changed files with 9 additions and 63 deletions

View File

@ -5,16 +5,6 @@ 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,19 +281,6 @@ 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,19 +2,16 @@ 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"`
Directory RecordDirectoryCmd `cmd:"" help:"Get/Set recording directory." aliases:"d"`
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"`
}
// RecordStartCmd starts the recording.
@ -35,11 +32,11 @@ type RecordStopCmd struct{} // size = 0x0
// Run executes the command to stop recording.
func (cmd *RecordStopCmd) Run(ctx *context) error {
resp, err := ctx.Client.Record.StopRecord()
_, err := ctx.Client.Record.StopRecord()
if err != nil {
return err
}
fmt.Fprintf(ctx.Out, "%s", fmt.Sprintf("Recording stopped successfully. Output file: %s\n", resp.OutputPath))
fmt.Fprintln(ctx.Out, "Recording stopped successfully.")
return nil
}
@ -135,30 +132,3 @@ 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,7 +2,6 @@ package main
import (
"bytes"
"strings"
"testing"
"time"
)
@ -46,7 +45,7 @@ func TestRecordStartStatusStop(t *testing.T) {
if err != nil {
t.Fatalf("Failed to stop recording: %v", err)
}
if !strings.Contains(out.String(), "Recording stopped successfully. Output file:") {
if out.String() != "Recording stopped successfully.\n" {
t.Fatalf("Expected output to be 'Recording stopped successfully.', got '%s'", out.String())
}
// Reset output buffer for the next command