figure out how to update a text item
This commit is contained in:
parent
a8daa54a1c
commit
b5adb5a747
BIN
electricboogaloo
BIN
electricboogaloo
Binary file not shown.
30
main.go
30
main.go
|
@ -1,26 +1,40 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"log"
|
||||||
|
|
||||||
"github.com/andreykaipov/goobs"
|
"github.com/andreykaipov/goobs"
|
||||||
|
"github.com/andreykaipov/goobs/api/requests/inputs"
|
||||||
|
"github.com/andreykaipov/goobs/api/requests/sceneitems"
|
||||||
|
"github.com/andreykaipov/goobs/api/typedefs"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
// change this password lol!
|
// change this password lol!
|
||||||
client, err := goobs.New("localhost:4455", goobs.WithPassword("wtiR9XcQ78a2kiNA"))
|
client, err := goobs.New("localhost:4455", goobs.WithPassword("lwihuN0OUVTMeCMM"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
defer client.Disconnect()
|
defer client.Disconnect()
|
||||||
|
params := sceneitems.NewGetSceneItemListParams().WithSceneName("cmus")
|
||||||
|
scil, err := client.SceneItems.GetSceneItemList(params)
|
||||||
|
|
||||||
version, err := client.General.GetVersion()
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
for i := range scil.SceneItems {
|
||||||
fmt.Printf("OBS Studio version: %s\n", version.ObsVersion)
|
if scil.SceneItems[i].SourceName == "Artist" {
|
||||||
fmt.Printf("Server protocol version: %s\n", version.ObsWebSocketVersion)
|
updateTextItem(client, scil.SceneItems[i])
|
||||||
fmt.Printf("Client protocol version: %s\n", goobs.ProtocolVersion)
|
}
|
||||||
fmt.Printf("Client library version: %s\n", goobs.LibraryVersion)
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func updateTextItem(client *goobs.Client, sI *typedefs.SceneItem) {
|
||||||
|
params := inputs.NewSetInputSettingsParams().WithInputName(sI.SourceName).WithInputUuid(sI.SourceUuid)
|
||||||
|
params.InputSettings = make(map[string]any)
|
||||||
|
params.InputSettings["text"] = "pens"
|
||||||
|
_, err := client.Inputs.SetInputSettings(params)
|
||||||
|
if err != nil {
|
||||||
|
log.Fatal(err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue