Fix: RecPlayPause not setting initial icon

This commit is contained in:
Core447 2024-07-03 17:24:47 +02:00
parent 62ed7318a6
commit a9dcc5b28e
No known key found for this signature in database
GPG Key ID: 5B97C0BD62F98516
1 changed files with 4 additions and 2 deletions

View File

@ -11,6 +11,7 @@ class RecPlayPause(OBSActionBase):
self.current_state = -1
def on_ready(self):
self.current_state = -1
# Connect to obs if not connected
if self.plugin_base.backend is not None:
if not self.plugin_base.get_connected():
@ -22,11 +23,11 @@ class RecPlayPause(OBSActionBase):
def show_current_rec_status(self, new_paused = False):
if not self.plugin_base.get_connected():
self.set_media(media_path=os.path.join(self.plugin_base.PATH, "assets", "error.png"))
self.show_error()
return
status = self.plugin_base.backend.get_record_status()
if status is None:
self.set_media(media_path=os.path.join(self.plugin_base.PATH, "assets", "error.png"))
self.show_error()
return
if status["active"] and not status["paused"]:
self.show_for_state(1)
@ -42,6 +43,7 @@ class RecPlayPause(OBSActionBase):
2: Paused
3: Stopping in progress
"""
self.hide_error()
if state == self.current_state:
return
self.current_state = state