mirror of
https://github.com/onyx-and-iris/gobs-cli.git
synced 2026-04-20 16:13:40 +00:00
Compare commits
4 Commits
v0.14.0
...
1c0ef025c1
| Author | SHA1 | Date | |
|---|---|---|---|
| 1c0ef025c1 | |||
| 2b7b8e0bd5 | |||
| 040ece840c | |||
| c6406888a9 |
@@ -5,7 +5,7 @@ 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.14.0] - 2025-07-14
|
# [0.14.1] - 2025-07-14
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ tasks:
|
|||||||
cmds:
|
cmds:
|
||||||
- task: build-windows
|
- task: build-windows
|
||||||
- task: build-linux
|
- task: build-linux
|
||||||
|
- task: build-macos
|
||||||
|
|
||||||
vet:
|
vet:
|
||||||
desc: Vet the code
|
desc: Vet the code
|
||||||
@@ -46,6 +47,12 @@ tasks:
|
|||||||
- GOOS=linux GOARCH=amd64 go build -ldflags "-X 'main.version={{.VERSION}}'" -o {{.BIN_DIR}}/{{.PROGRAM}}_linux_amd64
|
- GOOS=linux GOARCH=amd64 go build -ldflags "-X 'main.version={{.VERSION}}'" -o {{.BIN_DIR}}/{{.PROGRAM}}_linux_amd64
|
||||||
internal: true
|
internal: true
|
||||||
|
|
||||||
|
build-macos:
|
||||||
|
desc: Build the gobs-cli project for macOS
|
||||||
|
cmds:
|
||||||
|
- GOOS=darwin GOARCH=amd64 go build -ldflags "-X 'main.version={{.VERSION}}'" -o {{.BIN_DIR}}/{{.PROGRAM}}_darwin_amd64
|
||||||
|
internal: true
|
||||||
|
|
||||||
test:
|
test:
|
||||||
desc: Run tests
|
desc: Run tests
|
||||||
cmds:
|
cmds:
|
||||||
|
|||||||
@@ -2,11 +2,20 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
func skipIfSkipGroupTests(t *testing.T) {
|
||||||
|
if os.Getenv("GOBS_TEST_SKIP_GROUP_TESTS") != "" {
|
||||||
|
t.Skip("Skipping group tests due to GOBS_TEST_SKIP_GROUP_TESTS environment variable")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func TestGroupList(t *testing.T) {
|
func TestGroupList(t *testing.T) {
|
||||||
|
skipIfSkipGroupTests(t)
|
||||||
|
|
||||||
client, disconnect := getClient(t)
|
client, disconnect := getClient(t)
|
||||||
defer disconnect()
|
defer disconnect()
|
||||||
|
|
||||||
@@ -26,6 +35,8 @@ func TestGroupList(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestGroupShow(t *testing.T) {
|
func TestGroupShow(t *testing.T) {
|
||||||
|
skipIfSkipGroupTests(t)
|
||||||
|
|
||||||
client, disconnect := getClient(t)
|
client, disconnect := getClient(t)
|
||||||
defer disconnect()
|
defer disconnect()
|
||||||
|
|
||||||
@@ -46,6 +57,8 @@ func TestGroupShow(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestGroupToggle(t *testing.T) {
|
func TestGroupToggle(t *testing.T) {
|
||||||
|
skipIfSkipGroupTests(t)
|
||||||
|
|
||||||
client, disconnect := getClient(t)
|
client, disconnect := getClient(t)
|
||||||
defer disconnect()
|
defer disconnect()
|
||||||
|
|
||||||
@@ -87,6 +100,8 @@ func TestGroupToggle(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestGroupStatus(t *testing.T) {
|
func TestGroupStatus(t *testing.T) {
|
||||||
|
skipIfSkipGroupTests(t)
|
||||||
|
|
||||||
client, disconnect := getClient(t)
|
client, disconnect := getClient(t)
|
||||||
defer disconnect()
|
defer disconnect()
|
||||||
|
|
||||||
|
|||||||
@@ -22,9 +22,8 @@ func TestInputList(t *testing.T) {
|
|||||||
expectedInputs := []string{
|
expectedInputs := []string{
|
||||||
"Desktop Audio",
|
"Desktop Audio",
|
||||||
"Mic/Aux",
|
"Mic/Aux",
|
||||||
"Colour Source",
|
"gobs-test-input",
|
||||||
"Colour Source 2",
|
"gobs-test-input-2",
|
||||||
"Colour Source 3",
|
|
||||||
}
|
}
|
||||||
output := out.String()
|
output := out.String()
|
||||||
for _, input := range expectedInputs {
|
for _, input := range expectedInputs {
|
||||||
@@ -52,9 +51,8 @@ func TestInputListFilterInput(t *testing.T) {
|
|||||||
}
|
}
|
||||||
expectedFilteredOut := []string{
|
expectedFilteredOut := []string{
|
||||||
"Desktop Audio",
|
"Desktop Audio",
|
||||||
"Colour Source",
|
"gobs-test-input",
|
||||||
"Colour Source 2",
|
"gobs-test-input-2",
|
||||||
"Colour Source 3",
|
|
||||||
}
|
}
|
||||||
for _, input := range expectedInputs {
|
for _, input := range expectedInputs {
|
||||||
if !strings.Contains(out.String(), input) {
|
if !strings.Contains(out.String(), input) {
|
||||||
@@ -86,9 +84,8 @@ func TestInputListFilterOutput(t *testing.T) {
|
|||||||
}
|
}
|
||||||
expectedFilteredOut := []string{
|
expectedFilteredOut := []string{
|
||||||
"Mic/Aux",
|
"Mic/Aux",
|
||||||
"Colour Source",
|
"gobs-test-input",
|
||||||
"Colour Source 2",
|
"gobs-test-input-2",
|
||||||
"Colour Source 3",
|
|
||||||
}
|
}
|
||||||
for _, input := range expectedInputs {
|
for _, input := range expectedInputs {
|
||||||
if !strings.Contains(out.String(), input) {
|
if !strings.Contains(out.String(), input) {
|
||||||
@@ -116,9 +113,8 @@ func TestInputListFilterColour(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
expectedInputs := []string{
|
expectedInputs := []string{
|
||||||
"Colour Source",
|
"gobs-test-input",
|
||||||
"Colour Source 2",
|
"gobs-test-input-2",
|
||||||
"Colour Source 3",
|
|
||||||
}
|
}
|
||||||
for _, input := range expectedInputs {
|
for _, input := range expectedInputs {
|
||||||
if !strings.Contains(out.String(), input) {
|
if !strings.Contains(out.String(), input) {
|
||||||
|
|||||||
39
main_test.go
39
main_test.go
@@ -2,7 +2,9 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"os"
|
"os"
|
||||||
|
"runtime"
|
||||||
"testing"
|
"testing"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/andreykaipov/goobs"
|
"github.com/andreykaipov/goobs"
|
||||||
"github.com/andreykaipov/goobs/api/requests/config"
|
"github.com/andreykaipov/goobs/api/requests/config"
|
||||||
@@ -55,6 +57,22 @@ func TestMain(m *testing.M) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func setup(client *goobs.Client) {
|
func setup(client *goobs.Client) {
|
||||||
|
client.Config.CreateProfile(config.NewCreateProfileParams().
|
||||||
|
WithProfileName("gobs-test-profile"))
|
||||||
|
time.Sleep(2 * time.Second) // wait for profile creation to propagate
|
||||||
|
client.Config.SetProfileParameter(config.NewSetProfileParameterParams().
|
||||||
|
WithParameterCategory("SimpleOutput").
|
||||||
|
WithParameterName("RecRB").
|
||||||
|
WithParameterValue("true"))
|
||||||
|
client.Config.SetProfileParameter(config.NewSetProfileParameterParams().
|
||||||
|
WithParameterCategory("AdvOut").
|
||||||
|
WithParameterName("RecRB").
|
||||||
|
WithParameterValue("true"))
|
||||||
|
client.Config.SetCurrentProfile(config.NewSetCurrentProfileParams().
|
||||||
|
WithProfileName("Untitled"))
|
||||||
|
client.Config.SetCurrentProfile(config.NewSetCurrentProfileParams().
|
||||||
|
WithProfileName("gobs-test-profile"))
|
||||||
|
|
||||||
client.Config.SetStreamServiceSettings(config.NewSetStreamServiceSettingsParams().
|
client.Config.SetStreamServiceSettings(config.NewSetStreamServiceSettingsParams().
|
||||||
WithStreamServiceType("rtmp_common").
|
WithStreamServiceType("rtmp_common").
|
||||||
WithStreamServiceSettings(&typedefs.StreamServiceSettings{
|
WithStreamServiceSettings(&typedefs.StreamServiceSettings{
|
||||||
@@ -90,6 +108,24 @@ func setup(client *goobs.Client) {
|
|||||||
}).
|
}).
|
||||||
WithSceneItemEnabled(true))
|
WithSceneItemEnabled(true))
|
||||||
|
|
||||||
|
// ensure Desktop Audio input is created
|
||||||
|
var inputKind string
|
||||||
|
switch runtime.GOOS {
|
||||||
|
case "windows":
|
||||||
|
inputKind = "wasapi_output_capture"
|
||||||
|
case "linux":
|
||||||
|
inputKind = "pulse_output_capture"
|
||||||
|
case "darwin":
|
||||||
|
inputKind = "coreaudio_output_capture"
|
||||||
|
}
|
||||||
|
client.Inputs.CreateInput(inputs.NewCreateInputParams().
|
||||||
|
WithSceneName("gobs-test").
|
||||||
|
WithInputName("Desktop Audio").
|
||||||
|
WithInputKind(inputKind).
|
||||||
|
WithInputSettings(map[string]any{
|
||||||
|
"device_id": "default",
|
||||||
|
}))
|
||||||
|
|
||||||
// Create source filter on an audio input
|
// Create source filter on an audio input
|
||||||
client.Filters.CreateSourceFilter(filters.NewCreateSourceFilterParams().
|
client.Filters.CreateSourceFilter(filters.NewCreateSourceFilterParams().
|
||||||
WithSourceName("Mic/Aux").
|
WithSourceName("Mic/Aux").
|
||||||
@@ -115,6 +151,9 @@ func setup(client *goobs.Client) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func teardown(client *goobs.Client) {
|
func teardown(client *goobs.Client) {
|
||||||
|
client.Config.RemoveProfile(config.NewRemoveProfileParams().
|
||||||
|
WithProfileName("gobs-test-profile"))
|
||||||
|
|
||||||
client.Filters.RemoveSourceFilter(filters.NewRemoveSourceFilterParams().
|
client.Filters.RemoveSourceFilter(filters.NewRemoveSourceFilterParams().
|
||||||
WithSourceName("Mic/Aux").
|
WithSourceName("Mic/Aux").
|
||||||
WithFilterName("test_filter"))
|
WithFilterName("test_filter"))
|
||||||
|
|||||||
@@ -2,11 +2,20 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
func skipIfSkipReplayBufferTests(t *testing.T) {
|
||||||
|
if os.Getenv("GOBS_TEST_SKIP_REPLAYBUFFER_TESTS") != "" {
|
||||||
|
t.Skip("Skipping replay buffer tests due to GOBS_TEST_SKIP_REPLAYBUFFER_TESTS environment variable")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func TestReplayBufferStart(t *testing.T) {
|
func TestReplayBufferStart(t *testing.T) {
|
||||||
|
skipIfSkipReplayBufferTests(t)
|
||||||
|
|
||||||
client, disconnect := getClient(t)
|
client, disconnect := getClient(t)
|
||||||
defer disconnect()
|
defer disconnect()
|
||||||
|
|
||||||
@@ -24,6 +33,8 @@ func TestReplayBufferStart(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestReplayBufferStop(t *testing.T) {
|
func TestReplayBufferStop(t *testing.T) {
|
||||||
|
skipIfSkipReplayBufferTests(t)
|
||||||
|
|
||||||
client, disconnect := getClient(t)
|
client, disconnect := getClient(t)
|
||||||
defer disconnect()
|
defer disconnect()
|
||||||
|
|
||||||
@@ -41,6 +52,8 @@ func TestReplayBufferStop(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestReplayBufferToggle(t *testing.T) {
|
func TestReplayBufferToggle(t *testing.T) {
|
||||||
|
skipIfSkipReplayBufferTests(t)
|
||||||
|
|
||||||
client, disconnect := getClient(t)
|
client, disconnect := getClient(t)
|
||||||
defer disconnect()
|
defer disconnect()
|
||||||
|
|
||||||
|
|||||||
9
text.go
9
text.go
@@ -33,11 +33,18 @@ func (cmd *TextCurrentCmd) Run(ctx *context) error {
|
|||||||
return fmt.Errorf("input %s is of %s", cmd.InputName, kind)
|
return fmt.Errorf("input %s is of %s", cmd.InputName, kind)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
currentText, ok := resp.InputSettings["text"]
|
||||||
|
if !ok {
|
||||||
|
return fmt.Errorf("input %s does not have a 'text' setting", cmd.InputName)
|
||||||
|
}
|
||||||
|
if currentText == "" {
|
||||||
|
currentText = "(empty)"
|
||||||
|
}
|
||||||
fmt.Fprintf(
|
fmt.Fprintf(
|
||||||
ctx.Out,
|
ctx.Out,
|
||||||
"Current text for source %s: %s\n",
|
"Current text for source %s: %s\n",
|
||||||
ctx.Style.Highlight(cmd.InputName),
|
ctx.Style.Highlight(cmd.InputName),
|
||||||
resp.InputSettings["text"],
|
currentText,
|
||||||
)
|
)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user