Compare commits
3 Commits
Author | SHA1 | Date | |
---|---|---|---|
0ee045f172 | |||
c5db9d1f88 | |||
8de69d7c40 |
9
README.md
Normal file
9
README.md
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
StreamDeck OBS Replay
|
||||||
|
=====================
|
||||||
|
|
||||||
|
Installation
|
||||||
|
------------
|
||||||
|
|
||||||
|
Install [obs-websocket](https://github.com/Palakis/obs-websocket) and configure
|
||||||
|
|
||||||
|
Add plugin to Stream Deck (double click) and configure your icons with the host, port (default: 4444) and password (if configured).
|
@ -37,12 +37,12 @@
|
|||||||
"Author": "Meow.tf",
|
"Author": "Meow.tf",
|
||||||
"Category": "OBS Replay",
|
"Category": "OBS Replay",
|
||||||
"CodePathWin": "replay.exe",
|
"CodePathWin": "replay.exe",
|
||||||
"Description": "Control OBS' Replays using StreamDeck.",
|
"Description": "Control OBS' Replays using StreamDeck and obs-websocket",
|
||||||
"Name": "OBS Replay",
|
"Name": "OBS Replay",
|
||||||
"Icon": "images/pluginIcon",
|
"Icon": "images/pluginIcon",
|
||||||
"CategoryIcon": "images/pluginIcon",
|
"CategoryIcon": "images/pluginIcon",
|
||||||
"URL": "https://streamdeck.meow.tf/obsreplay",
|
"URL": "https://streamdeck.meow.tf/obsreplay",
|
||||||
"Version": "1.0.0",
|
"Version": "1.0.2",
|
||||||
"SDKVersion": 2,
|
"SDKVersion": 2,
|
||||||
"OS": [
|
"OS": [
|
||||||
{
|
{
|
||||||
|
33
replay.go
33
replay.go
@ -11,16 +11,16 @@ import (
|
|||||||
|
|
||||||
const (
|
const (
|
||||||
actionReplayToggle = "tf.meow.obsreplay.replay_toggle"
|
actionReplayToggle = "tf.meow.obsreplay.replay_toggle"
|
||||||
actionReplaySave = "tf.meow.obsreplay.replay_save"
|
actionReplaySave = "tf.meow.obsreplay.replay_save"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
contextMutex sync.RWMutex
|
contextMutex sync.RWMutex
|
||||||
clientMutex sync.RWMutex
|
clientMutex sync.RWMutex
|
||||||
stateMutex sync.RWMutex
|
stateMutex sync.RWMutex
|
||||||
|
|
||||||
clients = make(map[string]*obsws.Client)
|
clients = make(map[string]*obsws.Client)
|
||||||
contexts = make(map[string]string)
|
contexts = make(map[string]string)
|
||||||
cachedStates = make(map[string]int)
|
cachedStates = make(map[string]int)
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -52,6 +52,15 @@ func replaySave(action, context string, payload *fastjson.Value, deviceId string
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
stateMutex.RLock()
|
||||||
|
state, exists := cachedStates[context]
|
||||||
|
stateMutex.RUnlock()
|
||||||
|
|
||||||
|
if exists && state == 0 {
|
||||||
|
sdk.ShowAlert(context)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
req := obsws.NewSaveReplayBufferRequest()
|
req := obsws.NewSaveReplayBufferRequest()
|
||||||
|
|
||||||
if err := req.Send(c); err != nil {
|
if err := req.Send(c); err != nil {
|
||||||
@ -79,6 +88,14 @@ func clientForContext(context string) *obsws.Client {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if !c.Connected() {
|
||||||
|
err := c.Connect()
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return c
|
return c
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -122,12 +139,6 @@ func checkClient(host string, port int, password string) string {
|
|||||||
if !ok {
|
if !ok {
|
||||||
client = &obsws.Client{Host: host, Port: port, Password: password}
|
client = &obsws.Client{Host: host, Port: port, Password: password}
|
||||||
|
|
||||||
err := client.Connect()
|
|
||||||
|
|
||||||
if err != nil {
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
client.AddEventHandler("StreamStatus", streamStatusUpdate(key))
|
client.AddEventHandler("StreamStatus", streamStatusUpdate(key))
|
||||||
client.AddEventHandler("ReplayStarted", loopContextState(key, 1))
|
client.AddEventHandler("ReplayStarted", loopContextState(key, 1))
|
||||||
client.AddEventHandler("ReplayStopped", loopContextState(key, 0))
|
client.AddEventHandler("ReplayStopped", loopContextState(key, 0))
|
||||||
|
Reference in New Issue
Block a user