Fix: Possible crash if backend needs too long to start

This commit is contained in:
Core447 2024-03-26 19:08:18 +01:00
parent efb24e2f08
commit 4637027f89
No known key found for this signature in database
GPG Key ID: 5B97C0BD62F98516
3 changed files with 10 additions and 7 deletions

View File

@ -13,6 +13,7 @@ class RecPlayPause(OBSActionBase):
def on_ready(self): def on_ready(self):
# Connect to obs if not connected # Connect to obs if not connected
if self.plugin_base.backend is not None:
if not self.plugin_base.backend.get_connected(): if not self.plugin_base.backend.get_connected():
# self.plugin_base.obs.connect_to(host="localhost", port=4444, timeout=3, legacy=False) # self.plugin_base.obs.connect_to(host="localhost", port=4444, timeout=3, legacy=False)
self.reconnect_obs() self.reconnect_obs()

View File

@ -20,6 +20,7 @@ class SwitchScene(OBSActionBase):
def on_ready(self): def on_ready(self):
# Connect to obs if not connected # Connect to obs if not connected
if self.plugin_base.backend is not None:
if not self.plugin_base.backend.get_connected(): # self.plugin_base.obs.connect_to(host="localhost", port=4444, timeout=3, legacy=False) if not self.plugin_base.backend.get_connected(): # self.plugin_base.obs.connect_to(host="localhost", port=4444, timeout=3, legacy=False)
self.reconnect_obs() self.reconnect_obs()

View File

@ -14,6 +14,7 @@ class ToggleRecord(OBSActionBase):
def on_ready(self): def on_ready(self):
# Connect to obs if not connected # Connect to obs if not connected
if self.plugin_base.backend is not None:
if not self.plugin_base.backend.get_connected(): # self.plugin_base.obs.connect_to(host="localhost", port=4444, timeout=3, legacy=False) if not self.plugin_base.backend.get_connected(): # self.plugin_base.obs.connect_to(host="localhost", port=4444, timeout=3, legacy=False)
self.reconnect_obs() self.reconnect_obs()