diff --git a/README.md b/README.md index ff0d837..16ec141 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,12 @@ This is a wrapper around OBS Websocket. Not all endpoints in the official documentation are implemented. But all endpoints in the Requests section is implemented. You can find the relevant document using below link. [obs-websocket github page](https://github.com/obsproject/obs-websocket/blob/master/docs/generated/protocol.md#Requests) +## Requirements + +- [OBS Studio](https://obsproject.com/) +- [OBS Websocket v5 Plugin](https://github.com/obsproject/obs-websocket/releases/tag/5.0.0) +- Python 3.11 or greater + ### How to install using pip ``` diff --git a/obsstudio_sdk/callback.py b/obsstudio_sdk/callback.py index 24732c5..fc2c445 100644 --- a/obsstudio_sdk/callback.py +++ b/obsstudio_sdk/callback.py @@ -1,4 +1,5 @@ import re +from typing import Callable, Iterable, Union class Callback: @@ -28,16 +29,16 @@ class Callback: for fn in self._callbacks: if fn.__name__ == self.to_snake_case(event): if "eventData" in data: - fn(data["eventData"]) + fn(event, data["eventData"]) else: - fn() + fn(event) - def register(self, fns): + def register(self, fns: Union[Iterable, Callable]): """registers callback functions""" try: - iter(fns) - for fn in fns: + iterator = iter(fns) + for fn in iterator: if fn not in self._callbacks: self._callbacks.append(fn) except TypeError as e: