Skip to content

Fix status updates spam #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 10, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion streamonitor/bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ def __init__(self, username):
self.cookieUpdater = None
self.cookie_update_interval = 0

#this will store the latest status of the current model
self.previous_status = None

self.lastInfo = {} # This dict will hold information about stream after getStatus is called. One can use this in getVideoUrl
self.running = False
self.quitting = False
Expand Down Expand Up @@ -123,7 +126,10 @@ def run(self):
while self.running:
try:
self.sc = self.getStatus()
self.log(self.status())
# Check if the status has changed and log the update if it's different from the previous status
if self.sc != self.previous_status:
self.log(self.status())
self.previous_status = self.sc
if self.sc == self.Status.ERROR:
self._sleep(self.sleep_on_error)
if self.sc == self.Status.OFFLINE:
Expand Down