request and event data now returned as dataclasses

unit tests updated accordingly
This commit is contained in:
onyx-and-iris
2022-07-27 22:44:40 +01:00
parent f5c2293dce
commit 20851c3880
9 changed files with 52 additions and 25 deletions

View File

@@ -16,15 +16,15 @@ class Observer:
def on_current_program_scene_changed(self, data):
"""The current program scene has changed."""
print(f"Switched to scene {data['sceneName']}")
print(f"Switched to scene {data.scene_name}")
def on_scene_created(self, data):
"""A new scene has been created."""
print(f"scene {data['sceneName']} has been created")
print(f"scene {data.scene_name} has been created")
def on_input_mute_state_changed(self, data):
"""An input's mute state has changed."""
print(f"{data['inputName']} mute toggled")
print(f"{data.input_name} mute toggled")
def on_exit_started(self, data):
"""OBS has begun the shutdown process."""

View File

@@ -16,7 +16,7 @@ class Observer:
def on_current_program_scene_changed(self, data):
"""The current program scene has changed."""
print(f"{self.event_identifier}: {data}")
print(f"{self.event_identifier}: {data.scene_name}")
def version():

View File

@@ -5,7 +5,7 @@ import obsstudio_sdk as obs
def main():
resp = cl.get_scene_list()
scenes = reversed(tuple(di["sceneName"] for di in resp["scenes"]))
scenes = reversed(tuple(di.get("sceneName") for di in resp.scenes))
for sc in scenes:
print(f"Switching to scene {sc}")