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): def show_current_rec_status(self, new_paused = False):
if not self.plugin_base.backend.get_connected(): 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 return
status = self.plugin_base.backend.get_record_status() status = self.plugin_base.backend.get_record_status()
if status is None: 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 return
if status["active"] and not status["paused"]: if status["active"] and not status["paused"]:
self.show_for_state(1) self.show_for_state(1)

View File

@ -22,11 +22,11 @@ class ToggleRecord(OBSActionBase):
def show_current_rec_status(self, new_paused = False): def show_current_rec_status(self, new_paused = False):
if not self.plugin_base.backend.get_connected(): 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 return
status = self.plugin_base.backend.get_record_status() status = self.plugin_base.backend.get_record_status()
if status is None: 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 return
if status["paused"]: if status["paused"]:
self.show_for_state(2) 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): def connect_to(self, host=None, port=None, timeout=1, legacy=False, **kwargs):
try: try:
log.debug(f"Trying to connect to obs with legacy: {legacy}") 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) 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=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=5, **kwargs)
self.connect() self.connect()
log.info("Successfully connected to OBS") log.info("Successfully connected to OBS")
except (obswebsocket.exceptions.ConnectionFailure, ValueError) as e: except (obswebsocket.exceptions.ConnectionFailure, ValueError) as e:
try: try:
log.error(f"Failed to connect to OBS with legacy: {legacy}, trying with legacy: {not legacy}") 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) 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=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=5, **kwargs)
self.connect() self.connect()
log.info("Successfully connected to OBS") log.info("Successfully connected to OBS")

View File

@ -38,11 +38,10 @@ class OBS(PluginBase):
self.register( self.register(
plugin_name=self.lm.get("plugin.name"), plugin_name=self.lm.get("plugin.name"),
github_repo="https://github.com/Core447/OBSPlugin", github_repo="https://github.com/Core447/OBSPlugin",
plugin_version="0.1", plugin_version="1.0.0",
app_version="0.1.1-alpha", app_version="1.0.0-alpha",
) )
toggle_record_action_holder = ActionHolder( toggle_record_action_holder = ActionHolder(
plugin_base=self, plugin_base=self,
action_base=ToggleRecord, action_base=ToggleRecord,