Skip to content
This repository was archived by the owner on Jan 14, 2022. It is now read-only.

Update to obs-websocket 4.8.0 #8

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
[![GoDoc](https://godoc.org/github.com/christopher-dG/go-obs-websocket?status.svg)](https://godoc.org/github.com/christopher-dG/go-obs-websocket)

`obsws` provides client functionality for [`obs-websocket`](https://github.com/Palakis/obs-websocket).
Currently, the target version is `4.4`.
Currently, the target version is `4.8`.

## Installation

Expand Down
3 changes: 3 additions & 0 deletions codegen/protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,14 @@
"string": "string",
"array": "[]interface{}",
"array<string>": "[]string",
"string | object": "interface{}",
"object": "map[string]interface{}",
"output": "map[string]interface{}",
"array<object>": "[]map[string]interface{}",
"array<output>": "[]map[string]interface{}",
"array<scene>": "[]*Scene",
"array<sceneitem>": "[]*SceneItem",
"array<sceneitemtransform>": "[]*SceneItemTransform",
"obsstats": "*OBSStats",
"sceneitemtransform": "*SceneItemTransform",
}
Expand Down Expand Up @@ -385,6 +387,7 @@ def newlinify(s: str, comment: bool = True) -> str:

def optional_type(s: str) -> Tuple[str, bool]:
"""Determine if a type is optional and parse the actual type name."""
s = s.lower()
if s.endswith("(optional)"):
return s[: s.find("(optional)")].strip(), True
return s, False
Expand Down
9 changes: 9 additions & 0 deletions event_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ var eventMap = map[string]func() Event{
"TransitionListChanged": func() Event { return &TransitionListChangedEvent{} },
"TransitionDurationChanged": func() Event { return &TransitionDurationChangedEvent{} },
"TransitionBegin": func() Event { return &TransitionBeginEvent{} },
"TransitionEnd": func() Event { return &TransitionEndEvent{} },
"TransitionVideoEnd": func() Event { return &TransitionVideoEndEvent{} },
"ProfileChanged": func() Event { return &ProfileChangedEvent{} },
"ProfileListChanged": func() Event { return &ProfileListChangedEvent{} },
"StreamStarting": func() Event { return &StreamStartingEvent{} },
Expand Down Expand Up @@ -47,6 +49,7 @@ var eventMap = map[string]func() Event{
"SceneItemAdded": func() Event { return &SceneItemAddedEvent{} },
"SceneItemRemoved": func() Event { return &SceneItemRemovedEvent{} },
"SceneItemVisibilityChanged": func() Event { return &SceneItemVisibilityChangedEvent{} },
"SceneItemLockChanged": func() Event { return &SceneItemLockChangedEvent{} },
"SceneItemTransformChanged": func() Event { return &SceneItemTransformChangedEvent{} },
"SceneItemSelected": func() Event { return &SceneItemSelectedEvent{} },
"SceneItemDeselected": func() Event { return &SceneItemDeselectedEvent{} },
Expand Down Expand Up @@ -74,6 +77,10 @@ func derefEvent(e Event) Event {
return *e
case *TransitionBeginEvent:
return *e
case *TransitionEndEvent:
return *e
case *TransitionVideoEndEvent:
return *e
case *ProfileChangedEvent:
return *e
case *ProfileListChangedEvent:
Expand Down Expand Up @@ -144,6 +151,8 @@ func derefEvent(e Event) Event {
return *e
case *SceneItemVisibilityChangedEvent:
return *e
case *SceneItemLockChangedEvent:
return *e
case *SceneItemTransformChangedEvent:
return *e
case *SceneItemSelectedEvent:
Expand Down
160 changes: 160 additions & 0 deletions events_scene_items.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,160 @@
package obsws

// This file is automatically generated.
// https://github.com/christopher-dG/go-obs-websocket/blob/master/codegen/protocol.py

// SourceOrderChangedEvent : Scene items have been reordered.
//
// Since obs-websocket version: 4.0.0.
//
// https://github.com/Palakis/obs-websocket/blob/4.x-current/docs/generated/protocol.md#sourceorderchanged
type SourceOrderChangedEvent struct {
// Name of the scene where items have been reordered.
// Required: Yes.
SceneName string `json:"scene-name"`
// Ordered list of scene items.
// Required: Yes.
SceneItems []map[string]interface{} `json:"scene-items"`
// Item source name.
// Required: Yes.
SceneItemsSourceName string `json:"scene-items.*.source-name"`
// Scene item unique ID.
// Required: Yes.
SceneItemsItemID int `json:"scene-items.*.item-id"`
_event `json:",squash"`
}

// SceneItemAddedEvent : An item has been added to the current scene.
//
// Since obs-websocket version: 4.0.0.
//
// https://github.com/Palakis/obs-websocket/blob/4.x-current/docs/generated/protocol.md#sceneitemadded
type SceneItemAddedEvent struct {
// Name of the scene.
// Required: Yes.
SceneName string `json:"scene-name"`
// Name of the item added to the scene.
// Required: Yes.
ItemName string `json:"item-name"`
// Scene item ID.
// Required: Yes.
ItemID int `json:"item-id"`
_event `json:",squash"`
}

// SceneItemRemovedEvent : An item has been removed from the current scene.
//
// Since obs-websocket version: 4.0.0.
//
// https://github.com/Palakis/obs-websocket/blob/4.x-current/docs/generated/protocol.md#sceneitemremoved
type SceneItemRemovedEvent struct {
// Name of the scene.
// Required: Yes.
SceneName string `json:"scene-name"`
// Name of the item removed from the scene.
// Required: Yes.
ItemName string `json:"item-name"`
// Scene item ID.
// Required: Yes.
ItemID int `json:"item-id"`
_event `json:",squash"`
}

// SceneItemVisibilityChangedEvent : An item's visibility has been toggled.
//
// Since obs-websocket version: 4.0.0.
//
// https://github.com/Palakis/obs-websocket/blob/4.x-current/docs/generated/protocol.md#sceneitemvisibilitychanged
type SceneItemVisibilityChangedEvent struct {
// Name of the scene.
// Required: Yes.
SceneName string `json:"scene-name"`
// Name of the item in the scene.
// Required: Yes.
ItemName string `json:"item-name"`
// Scene item ID.
// Required: Yes.
ItemID int `json:"item-id"`
// New visibility state of the item.
// Required: Yes.
ItemVisible bool `json:"item-visible"`
_event `json:",squash"`
}

// SceneItemLockChangedEvent : An item's locked status has been toggled.
//
// Since obs-websocket version: 4.8.0.
//
// https://github.com/Palakis/obs-websocket/blob/4.x-current/docs/generated/protocol.md#sceneitemlockchanged
type SceneItemLockChangedEvent struct {
// Name of the scene.
// Required: Yes.
SceneName string `json:"scene-name"`
// Name of the item in the scene.
// Required: Yes.
ItemName string `json:"item-name"`
// Scene item ID.
// Required: Yes.
ItemID int `json:"item-id"`
// New locked state of the item.
// Required: Yes.
ItemLocked bool `json:"item-locked"`
_event `json:",squash"`
}

// SceneItemTransformChangedEvent : An item's transform has been changed.
//
// Since obs-websocket version: 4.6.0.
//
// https://github.com/Palakis/obs-websocket/blob/4.x-current/docs/generated/protocol.md#sceneitemtransformchanged
type SceneItemTransformChangedEvent struct {
// Name of the scene.
// Required: Yes.
SceneName string `json:"scene-name"`
// Name of the item in the scene.
// Required: Yes.
ItemName string `json:"item-name"`
// Scene item ID.
// Required: Yes.
ItemID int `json:"item-id"`
// Scene item transform properties.
// Required: Yes.
Transform *SceneItemTransform `json:"transform"`
_event `json:",squash"`
}

// SceneItemSelectedEvent : A scene item is selected.
//
// Since obs-websocket version: 4.6.0.
//
// https://github.com/Palakis/obs-websocket/blob/4.x-current/docs/generated/protocol.md#sceneitemselected
type SceneItemSelectedEvent struct {
// Name of the scene.
// Required: Yes.
SceneName string `json:"scene-name"`
// Name of the item in the scene.
// Required: Yes.
ItemName string `json:"item-name"`
// Name of the item in the scene.
// Required: Yes.
ItemID int `json:"item-id"`
_event `json:",squash"`
}

// SceneItemDeselectedEvent : A scene item is deselected.
//
// Since obs-websocket version: 4.6.0.
//
// https://github.com/Palakis/obs-websocket/blob/4.x-current/docs/generated/protocol.md#sceneitemdeselected
type SceneItemDeselectedEvent struct {
// Name of the scene.
// Required: Yes.
SceneName string `json:"scene-name"`
// Name of the item in the scene.
// Required: Yes.
ItemName string `json:"item-name"`
// Name of the item in the scene.
// Required: Yes.
ItemID int `json:"item-id"`
_event `json:",squash"`
}
140 changes: 4 additions & 136 deletions events_sources.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,10 @@ type SourceRenamedEvent struct {
// New source name.
// Required: Yes.
NewName string `json:"newName"`
_event `json:",squash"`
// Type of source (input, scene, filter, transition).
// Required: Yes.
SourceType string `json:"sourceType"`
_event `json:",squash"`
}

// SourceFilterAddedEvent : A filter was added to a source.
Expand Down Expand Up @@ -207,138 +210,3 @@ type SourceFiltersReorderedEvent struct {
FiltersType string `json:"filters.*.type"`
_event `json:",squash"`
}

// SourceOrderChangedEvent : Scene items have been reordered.
//
// Since obs-websocket version: 4.0.0.
//
// https://github.com/Palakis/obs-websocket/blob/4.x-current/docs/generated/protocol.md#sourceorderchanged
type SourceOrderChangedEvent struct {
// Name of the scene where items have been reordered.
// Required: Yes.
SceneName string `json:"scene-name"`
// Ordered list of scene items.
// Required: Yes.
SceneItems []map[string]interface{} `json:"scene-items"`
// Item source name.
// Required: Yes.
SceneItemsSourceName string `json:"scene-items.*.source-name"`
// Scene item unique ID.
// Required: Yes.
SceneItemsItemID int `json:"scene-items.*.item-id"`
_event `json:",squash"`
}

// SceneItemAddedEvent : An item has been added to the current scene.
//
// Since obs-websocket version: 4.0.0.
//
// https://github.com/Palakis/obs-websocket/blob/4.x-current/docs/generated/protocol.md#sceneitemadded
type SceneItemAddedEvent struct {
// Name of the scene.
// Required: Yes.
SceneName string `json:"scene-name"`
// Name of the item added to the scene.
// Required: Yes.
ItemName string `json:"item-name"`
// Scene item ID.
// Required: Yes.
ItemID int `json:"item-id"`
_event `json:",squash"`
}

// SceneItemRemovedEvent : An item has been removed from the current scene.
//
// Since obs-websocket version: 4.0.0.
//
// https://github.com/Palakis/obs-websocket/blob/4.x-current/docs/generated/protocol.md#sceneitemremoved
type SceneItemRemovedEvent struct {
// Name of the scene.
// Required: Yes.
SceneName string `json:"scene-name"`
// Name of the item removed from the scene.
// Required: Yes.
ItemName string `json:"item-name"`
// Scene item ID.
// Required: Yes.
ItemID int `json:"item-id"`
_event `json:",squash"`
}

// SceneItemVisibilityChangedEvent : An item's visibility has been toggled.
//
// Since obs-websocket version: 4.0.0.
//
// https://github.com/Palakis/obs-websocket/blob/4.x-current/docs/generated/protocol.md#sceneitemvisibilitychanged
type SceneItemVisibilityChangedEvent struct {
// Name of the scene.
// Required: Yes.
SceneName string `json:"scene-name"`
// Name of the item in the scene.
// Required: Yes.
ItemName string `json:"item-name"`
// Scene item ID.
// Required: Yes.
ItemID int `json:"item-id"`
// New visibility state of the item.
// Required: Yes.
ItemVisible bool `json:"item-visible"`
_event `json:",squash"`
}

// SceneItemTransformChangedEvent : An item's transform has been changed.
//
// Since obs-websocket version: 4.6.0.
//
// https://github.com/Palakis/obs-websocket/blob/4.x-current/docs/generated/protocol.md#sceneitemtransformchanged
type SceneItemTransformChangedEvent struct {
// Name of the scene.
// Required: Yes.
SceneName string `json:"scene-name"`
// Name of the item in the scene.
// Required: Yes.
ItemName string `json:"item-name"`
// Scene item ID.
// Required: Yes.
ItemID int `json:"item-id"`
// Scene item transform properties.
// Required: Yes.
Transform *SceneItemTransform `json:"transform"`
_event `json:",squash"`
}

// SceneItemSelectedEvent : A scene item is selected.
//
// Since obs-websocket version: 4.6.0.
//
// https://github.com/Palakis/obs-websocket/blob/4.x-current/docs/generated/protocol.md#sceneitemselected
type SceneItemSelectedEvent struct {
// Name of the scene.
// Required: Yes.
SceneName string `json:"scene-name"`
// Name of the item in the scene.
// Required: Yes.
ItemName string `json:"item-name"`
// Name of the item in the scene.
// Required: Yes.
ItemID int `json:"item-id"`
_event `json:",squash"`
}

// SceneItemDeselectedEvent : A scene item is deselected.
//
// Since obs-websocket version: 4.6.0.
//
// https://github.com/Palakis/obs-websocket/blob/4.x-current/docs/generated/protocol.md#sceneitemdeselected
type SceneItemDeselectedEvent struct {
// Name of the scene.
// Required: Yes.
SceneName string `json:"scene-name"`
// Name of the item in the scene.
// Required: Yes.
ItemName string `json:"item-name"`
// Name of the item in the scene.
// Required: Yes.
ItemID int `json:"item-id"`
_event `json:",squash"`
}
Loading