mirror of
https://github.com/onyx-and-iris/gobs-cli.git
synced 2025-08-07 20:21:48 +00:00
Compare commits
No commits in common. "306f19eeae497d3d8d7d3d85cd509727e516fcf2" and "c27a5ea6c5898046d792c7b52097f9d10ef47527" have entirely different histories.
306f19eeae
...
c27a5ea6c5
10
CHANGELOG.md
10
CHANGELOG.md
@ -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/),
|
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).
|
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
|
# [0.7.0] - 2025-05-26
|
||||||
|
|
||||||
|
13
README.md
13
README.md
@ -281,19 +281,6 @@ gobs-cli record pause
|
|||||||
gobs-cli record resume
|
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
|
### StreamCmd
|
||||||
|
|
||||||
- start: Start streaming.
|
- start: Start streaming.
|
||||||
|
46
record.go
46
record.go
@ -2,19 +2,16 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/andreykaipov/goobs/api/requests/config"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// RecordCmd handles the recording commands.
|
// RecordCmd handles the recording commands.
|
||||||
type RecordCmd struct {
|
type RecordCmd struct {
|
||||||
Start RecordStartCmd `cmd:"" help:"Start recording." aliases:"s"`
|
Start RecordStartCmd `cmd:"" help:"Start recording." aliases:"s"`
|
||||||
Stop RecordStopCmd `cmd:"" help:"Stop recording." aliases:"st"`
|
Stop RecordStopCmd `cmd:"" help:"Stop recording." aliases:"st"`
|
||||||
Toggle RecordToggleCmd `cmd:"" help:"Toggle recording." aliases:"tg"`
|
Toggle RecordToggleCmd `cmd:"" help:"Toggle recording." aliases:"tg"`
|
||||||
Status RecordStatusCmd `cmd:"" help:"Show recording status." aliases:"ss"`
|
Status RecordStatusCmd `cmd:"" help:"Show recording status." aliases:"ss"`
|
||||||
Pause RecordPauseCmd `cmd:"" help:"Pause recording." aliases:"p"`
|
Pause RecordPauseCmd `cmd:"" help:"Pause recording." aliases:"p"`
|
||||||
Resume RecordResumeCmd `cmd:"" help:"Resume recording." aliases:"r"`
|
Resume RecordResumeCmd `cmd:"" help:"Resume recording." aliases:"r"`
|
||||||
Directory RecordDirectoryCmd `cmd:"" help:"Get/Set recording directory." aliases:"d"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// RecordStartCmd starts the recording.
|
// RecordStartCmd starts the recording.
|
||||||
@ -35,11 +32,11 @@ type RecordStopCmd struct{} // size = 0x0
|
|||||||
|
|
||||||
// Run executes the command to stop recording.
|
// Run executes the command to stop recording.
|
||||||
func (cmd *RecordStopCmd) Run(ctx *context) error {
|
func (cmd *RecordStopCmd) Run(ctx *context) error {
|
||||||
resp, err := ctx.Client.Record.StopRecord()
|
_, err := ctx.Client.Record.StopRecord()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
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
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -135,30 +132,3 @@ func (cmd *RecordResumeCmd) Run(ctx *context) error {
|
|||||||
fmt.Fprintln(ctx.Out, "Recording resumed successfully.")
|
fmt.Fprintln(ctx.Out, "Recording resumed successfully.")
|
||||||
return nil
|
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
|
|
||||||
}
|
|
||||||
|
@ -2,7 +2,6 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"strings"
|
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
@ -46,7 +45,7 @@ func TestRecordStartStatusStop(t *testing.T) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("Failed to stop recording: %v", err)
|
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())
|
t.Fatalf("Expected output to be 'Recording stopped successfully.', got '%s'", out.String())
|
||||||
}
|
}
|
||||||
// Reset output buffer for the next command
|
// Reset output buffer for the next command
|
||||||
|
Loading…
x
Reference in New Issue
Block a user