Add compatability for app version 1.0.0-alpha

This commit is contained in:
Core447 2024-03-07 16:02:25 +01:00
parent e0823734c9
commit c5271e732c
No known key found for this signature in database
GPG Key ID: 5B97C0BD62F98516
4 changed files with 10 additions and 11 deletions

View File

@ -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)

View File

@ -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)

View File

@ -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")

View File

@ -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,