Skip to content

Commit 30c66ed

Browse files
authored
Merge pull request #1 from xAstroBoy/patch-2
Fix status updates spam
2 parents 70fc022 + 377ada7 commit 30c66ed

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

streamonitor/bot.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,9 @@ def __init__(self, username):
6969
self.cookieUpdater = None
7070
self.cookie_update_interval = 0
7171

72+
#this will store the latest status of the current model
73+
self.previous_status = None
74+
7275
self.lastInfo = {} # This dict will hold information about stream after getStatus is called. One can use this in getVideoUrl
7376
self.running = False
7477
self.quitting = False
@@ -132,7 +135,10 @@ def run(self):
132135
while self.running:
133136
try:
134137
self.sc = self.getStatus()
135-
self.log(self.status())
138+
# Check if the status has changed and log the update if it's different from the previous status
139+
if self.sc != self.previous_status:
140+
self.log(self.status())
141+
self.previous_status = self.sc
136142
if self.sc == self.Status.ERROR:
137143
self._sleep(self.sleep_on_error)
138144
if self.sc == self.Status.OFFLINE:

0 commit comments

Comments
 (0)