Handle comercial stream state
This commit is contained in:
1 parent
c112003a38
commit
fdc9dabd49
1 file changed
+8
-5
@@ -478,11 +478,7 @@ class Twitch:
|
|||||||
if channel is None:
|
if channel is None:
|
||||||
logger.error(f"Stream state change for a non-existing channel: {channel_id}")
|
logger.error(f"Stream state change for a non-existing channel: {channel_id}")
|
||||||
return
|
return
|
||||||
if msg_type == "stream-down":
|
if msg_type == "viewcount":
|
||||||
channel.set_offline()
|
|
||||||
elif msg_type == "stream-up":
|
|
||||||
channel.set_online()
|
|
||||||
elif msg_type == "viewcount":
|
|
||||||
if not channel.online:
|
if not channel.online:
|
||||||
# if it's not online for some reason, set it so
|
# if it's not online for some reason, set it so
|
||||||
channel.set_online()
|
channel.set_online()
|
||||||
@@ -491,6 +487,13 @@ class Twitch:
|
|||||||
channel.viewers = viewers
|
channel.viewers = viewers
|
||||||
channel.display()
|
channel.display()
|
||||||
# logger.debug(f"{channel.name} viewers: {viewers}")
|
# logger.debug(f"{channel.name} viewers: {viewers}")
|
||||||
|
elif msg_type == "stream-down":
|
||||||
|
channel.set_offline()
|
||||||
|
elif msg_type == "stream-up":
|
||||||
|
channel.set_online()
|
||||||
|
elif msg_type == "commercial":
|
||||||
|
# skip these
|
||||||
|
pass
|
||||||
else:
|
else:
|
||||||
logger.warning(f"Unknown stream state: {msg_type}")
|
logger.warning(f"Unknown stream state: {msg_type}")
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user