From 5a8c5ce9d7a37842715488e8b84d85fd00765562 Mon Sep 17 00:00:00 2001 From: Joshua Gottlieb Date: Tue, 15 Oct 2024 08:50:40 -0500 Subject: [PATCH] adding option to skip twitch thumbnail double checking --- DefaultConstants.py | 6 +++++- checkers/Twitch.py | 3 ++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/DefaultConstants.py b/DefaultConstants.py index b92d29b..9d73a70 100644 --- a/DefaultConstants.py +++ b/DefaultConstants.py @@ -231,4 +231,8 @@ class Constants: # Calm is default bot avatar, pissed is what it changes to after MIN_TIME_BEFORE_AVATAR_CHANGE has been met # Make them the same image if you don't want the feature to change anything calmAvatar = 'images/avatars/calmStreamer.png' - pissedAvatar = 'images/avatars/pissedStreamer.png' \ No newline at end of file + pissedAvatar = 'images/avatars/pissedStreamer.png' + + # In some cases a Twitch channel will show online when they aren't. If that's the case turn this to TRUE. + # This checks the channel's thumbnail to see if it is actually online with the downside of it taking a while longer to show the streamer as online + twitchCheckThumbnail = False \ No newline at end of file diff --git a/checkers/Twitch.py b/checkers/Twitch.py index 4d30116..550de5e 100644 --- a/checkers/Twitch.py +++ b/checkers/Twitch.py @@ -34,7 +34,8 @@ def isModelOnline(twitchChannelName): logger.debug(f"IsOnline: {isOnlineJson}") logger.debug(f"ThumbUrl: {tempThumbUrl}") logger.debug(f"ThumbReqUrl:{thumbUrlReq.url}") - if isOnlineJson and tempThumbUrl == thumbUrlReq.url: + thumbnailGood = tempThumbUrl == thumbUrlReq.url if Constants.twitchCheckThumbnail else True + if isOnlineJson and thumbnailGood: tempThumbUrl = tempThumbUrl + "?" + str(int(time.time())) isOnline = True except requests.exceptions.ConnectTimeout: