41 lines
1.3 KiB
Python
41 lines
1.3 KiB
Python
from __future__ import annotations
|
|
|
|
|
|
class OBSIntegrationPlugin:
|
|
name = "OBS Integration"
|
|
desc = "Sample backend plugin showing typed actions for future OBS control."
|
|
version = "0.1.0"
|
|
actions = [
|
|
{
|
|
"id": "switch_scene",
|
|
"name": "Switch Scene",
|
|
"desc": "Switch OBS to a named scene. This sample logs the intended action.",
|
|
"fields": [
|
|
{"id": "scene", "label": "Scene Name", "type": "text", "required": True, "default": "Starting Soon"},
|
|
],
|
|
},
|
|
{
|
|
"id": "toggle_stream",
|
|
"name": "Toggle Stream",
|
|
"desc": "Toggle stream state. This sample logs the intended action.",
|
|
"fields": [],
|
|
},
|
|
]
|
|
|
|
def on_load(self, ctx):
|
|
ctx.db.add_event("plugin.loaded", {"plugin": self.name})
|
|
|
|
def on_event(self, ctx, event):
|
|
if event["type"].startswith("button."):
|
|
ctx.db.add_event("plugin.event", {"plugin": self.name, "event": event["type"]})
|
|
|
|
def execute_action(self, ctx, action_id, config, event):
|
|
ctx.db.add_event(
|
|
"plugin.action",
|
|
{"plugin": self.name, "action_id": action_id, "config": config, "source_event": event},
|
|
)
|
|
|
|
|
|
PLUGIN = OBSIntegrationPlugin()
|
|
|