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,9 +13,10 @@ class RecPlayPause(OBSActionBase):
def on_ready(self): def on_ready(self):
# Connect to obs if not connected # Connect to obs if not connected
if not self.plugin_base.backend.get_connected(): if self.plugin_base.backend is not None:
# self.plugin_base.obs.connect_to(host="localhost", port=4444, timeout=3, legacy=False) if not self.plugin_base.backend.get_connected():
self.reconnect_obs() # self.plugin_base.obs.connect_to(host="localhost", port=4444, timeout=3, legacy=False)
self.reconnect_obs()
# Show current rec status # Show current rec status
self.show_current_rec_status() self.show_current_rec_status()

View File

@ -20,8 +20,9 @@ class SwitchScene(OBSActionBase):
def on_ready(self): def on_ready(self):
# Connect to obs if not connected # Connect to obs if not connected
if not self.plugin_base.backend.get_connected(): # self.plugin_base.obs.connect_to(host="localhost", port=4444, timeout=3, legacy=False) if self.plugin_base.backend is not None:
self.reconnect_obs() 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()
media_path = os.path.join(self.plugin_base.PATH, "assets", "transition_slide.png") media_path = os.path.join(self.plugin_base.PATH, "assets", "transition_slide.png")
self.set_media(media_path=media_path, size=0.75) self.set_media(media_path=media_path, size=0.75)

View File

@ -14,8 +14,9 @@ class ToggleRecord(OBSActionBase):
def on_ready(self): def on_ready(self):
# Connect to obs if not connected # Connect to obs if not connected
if not self.plugin_base.backend.get_connected(): # self.plugin_base.obs.connect_to(host="localhost", port=4444, timeout=3, legacy=False) if self.plugin_base.backend is not None:
self.reconnect_obs() 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()
# Show current rec status # Show current rec status
self.show_current_rec_status() self.show_current_rec_status()