mirror of
https://github.com/onyx-and-iris/obsws-python.git
synced 2024-11-24 22:00:52 +00:00
Merge pull request #10 from onyx-and-iris/main
pass empty dict if data is None in trigger()
This commit is contained in:
commit
69b0d4137a
@ -26,7 +26,7 @@ class Observer:
|
|||||||
"""An input's mute state has changed."""
|
"""An input's mute state has changed."""
|
||||||
print(f"{data.input_name} mute toggled")
|
print(f"{data.input_name} mute toggled")
|
||||||
|
|
||||||
def on_exit_started(self, data):
|
def on_exit_started(self, _):
|
||||||
"""OBS has begun the shutdown process."""
|
"""OBS has begun the shutdown process."""
|
||||||
print(f"OBS closing!")
|
print(f"OBS closing!")
|
||||||
self._cl.unsubscribe()
|
self._cl.unsubscribe()
|
||||||
|
@ -35,10 +35,9 @@ class ObsClient:
|
|||||||
|
|
||||||
def _conn_from_toml(self):
|
def _conn_from_toml(self):
|
||||||
filepath = Path.cwd() / "config.toml"
|
filepath = Path.cwd() / "config.toml"
|
||||||
self._conn = dict()
|
|
||||||
with open(filepath, "rb") as f:
|
with open(filepath, "rb") as f:
|
||||||
self._conn = tomllib.load(f)
|
conn = tomllib.load(f)
|
||||||
return self._conn["connection"]
|
return conn["connection"]
|
||||||
|
|
||||||
def authenticate(self):
|
def authenticate(self):
|
||||||
secret = base64.b64encode(
|
secret = base64.b64encode(
|
||||||
|
@ -61,7 +61,7 @@ class EventClient:
|
|||||||
self.data["d"].get("eventType"),
|
self.data["d"].get("eventType"),
|
||||||
self.data["d"].get("eventData"),
|
self.data["d"].get("eventData"),
|
||||||
)
|
)
|
||||||
self.callback.trigger(event, data)
|
self.callback.trigger(event, data if data else {})
|
||||||
time.sleep(self.DELAY)
|
time.sleep(self.DELAY)
|
||||||
|
|
||||||
def unsubscribe(self):
|
def unsubscribe(self):
|
||||||
@ -69,3 +69,4 @@ class EventClient:
|
|||||||
stop listening for events
|
stop listening for events
|
||||||
"""
|
"""
|
||||||
self.running = False
|
self.running = False
|
||||||
|
self.base_client.ws.close()
|
||||||
|
2
setup.py
2
setup.py
@ -5,7 +5,7 @@ from setuptools import find_packages, setup
|
|||||||
HERE = pathlib.Path(__file__).parent
|
HERE = pathlib.Path(__file__).parent
|
||||||
|
|
||||||
|
|
||||||
VERSION = "1.1.0"
|
VERSION = "1.1.1"
|
||||||
PACKAGE_NAME = "obsws-python"
|
PACKAGE_NAME = "obsws-python"
|
||||||
AUTHOR = "Adem Atikturk"
|
AUTHOR = "Adem Atikturk"
|
||||||
AUTHOR_EMAIL = "aatikturk@gmail.com"
|
AUTHOR_EMAIL = "aatikturk@gmail.com"
|
||||||
|
Loading…
Reference in New Issue
Block a user