From c5271e732c8ee10c2fb3706c5bd6ace562d51415 Mon Sep 17 00:00:00 2001 From: Core447 Date: Thu, 7 Mar 2024 16:02:25 +0100 Subject: [PATCH] Add compatability for app version 1.0.0-alpha --- actions/RecPlayPause/RecPlayPause.py | 4 ++-- actions/ToggleRecord/ToggleRecord.py | 4 ++-- backend/OBSController.py | 8 ++++---- main.py | 5 ++--- 4 files changed, 10 insertions(+), 11 deletions(-) diff --git a/actions/RecPlayPause/RecPlayPause.py b/actions/RecPlayPause/RecPlayPause.py index d2248e4..e00edc3 100644 --- a/actions/RecPlayPause/RecPlayPause.py +++ b/actions/RecPlayPause/RecPlayPause.py @@ -22,11 +22,11 @@ class RecPlayPause(OBSActionBase): def show_current_rec_status(self, new_paused = False): if not self.plugin_base.backend.get_connected(): - self.set_key(media_path=os.path.join(self.plugin_base.PATH, "assets", "error.png")) + self.set_media(media_path=os.path.join(self.plugin_base.PATH, "assets", "error.png")) return status = self.plugin_base.backend.get_record_status() if status is None: - self.set_key(media_path=os.path.join(self.plugin_base.PATH, "assets", "error.png")) + self.set_media(media_path=os.path.join(self.plugin_base.PATH, "assets", "error.png")) return if status["active"] and not status["paused"]: self.show_for_state(1) diff --git a/actions/ToggleRecord/ToggleRecord.py b/actions/ToggleRecord/ToggleRecord.py index acff83b..6852cd5 100644 --- a/actions/ToggleRecord/ToggleRecord.py +++ b/actions/ToggleRecord/ToggleRecord.py @@ -22,11 +22,11 @@ class ToggleRecord(OBSActionBase): def show_current_rec_status(self, new_paused = False): if not self.plugin_base.backend.get_connected(): - self.set_key(media_path=os.path.join(self.plugin_base.PATH, "assets", "error.png")) + self.set_media(media_path=os.path.join(self.plugin_base.PATH, "assets", "error.png")) return status = self.plugin_base.backend.get_record_status() if status is None: - self.set_key(media_path=os.path.join(self.plugin_base.PATH, "assets", "error.png")) + self.set_media(media_path=os.path.join(self.plugin_base.PATH, "assets", "error.png")) return if status["paused"]: self.show_for_state(2) diff --git a/backend/OBSController.py b/backend/OBSController.py index 6f77eb6..84c291d 100644 --- a/backend/OBSController.py +++ b/backend/OBSController.py @@ -18,15 +18,15 @@ class OBSController(obsws): def connect_to(self, host=None, port=None, timeout=1, legacy=False, **kwargs): try: log.debug(f"Trying to connect to obs with legacy: {legacy}") - super().__init__(host=host, port=port, timeout=timeout, legacy=legacy, on_connect=self.on_connect, on_disconnect=self.on_disconnect, authreconnect=True, **kwargs) - self.event_obs = obsws(host=host, port=port, timeout=timeout, legacy=legacy, on_connect=self.on_connect, on_disconnect=self.on_disconnect, authreconnect=True, **kwargs) + super().__init__(host=host, port=port, timeout=timeout, legacy=legacy, on_connect=self.on_connect, on_disconnect=self.on_disconnect, authreconnect=5, **kwargs) + self.event_obs = obsws(host=host, port=port, timeout=timeout, legacy=legacy, on_connect=self.on_connect, on_disconnect=self.on_disconnect, authreconnect=5, **kwargs) self.connect() log.info("Successfully connected to OBS") except (obswebsocket.exceptions.ConnectionFailure, ValueError) as e: try: log.error(f"Failed to connect to OBS with legacy: {legacy}, trying with legacy: {not legacy}") - super().__init__(host=host, port=port, timeout=timeout, legacy=not legacy, on_connect=self.on_connect, on_disconnect=self.on_disconnect, authreconnect=True, **kwargs) - self.event_obs = obsws(host=host, port=port, timeout=timeout, legacy=not legacy, on_connect=self.on_connect, on_disconnect=self.on_disconnect, authreconnect=True, **kwargs) + super().__init__(host=host, port=port, timeout=timeout, legacy=not legacy, on_connect=self.on_connect, on_disconnect=self.on_disconnect, authreconnect=5, **kwargs) + self.event_obs = obsws(host=host, port=port, timeout=timeout, legacy=not legacy, on_connect=self.on_connect, on_disconnect=self.on_disconnect, authreconnect=5, **kwargs) self.connect() log.info("Successfully connected to OBS") diff --git a/main.py b/main.py index cd2ef74..b0b3b64 100644 --- a/main.py +++ b/main.py @@ -38,11 +38,10 @@ class OBS(PluginBase): self.register( plugin_name=self.lm.get("plugin.name"), github_repo="https://github.com/Core447/OBSPlugin", - plugin_version="0.1", - app_version="0.1.1-alpha", + plugin_version="1.0.0", + app_version="1.0.0-alpha", ) - toggle_record_action_holder = ActionHolder( plugin_base=self, action_base=ToggleRecord,