Fix an issue with the miner not switching to a channel in a particular case;
The case involves an ONLINE channel, that stays ONLINE, but had it's tags and status updated from non-watchable to watchable
This commit is contained in:
1 parent
6b64b94b34
commit
651d73a342
1 file changed
+13
-10
@@ -1102,10 +1102,8 @@ class Twitch:
|
|||||||
if stream_before is None:
|
if stream_before is None:
|
||||||
if stream_after is not None:
|
if stream_after is not None:
|
||||||
# Channel going ONLINE
|
# Channel going ONLINE
|
||||||
if (
|
if self.can_watch(channel) and self.should_switch(channel):
|
||||||
self.can_watch(channel) # we can watch the channel
|
# we can watch the channel, and we should
|
||||||
and self.should_switch(channel) # and we should!
|
|
||||||
):
|
|
||||||
self.print(_("status", "goes_online").format(channel=channel.name))
|
self.print(_("status", "goes_online").format(channel=channel.name))
|
||||||
self.watch(channel)
|
self.watch(channel)
|
||||||
else:
|
else:
|
||||||
@@ -1115,12 +1113,11 @@ class Twitch:
|
|||||||
logger.log(CALL, f"{channel.name} stays OFFLINE")
|
logger.log(CALL, f"{channel.name} stays OFFLINE")
|
||||||
else:
|
else:
|
||||||
watching_channel = self.watching_channel.get_with_default(None)
|
watching_channel = self.watching_channel.get_with_default(None)
|
||||||
if (
|
# check if the watching channel was the one updated
|
||||||
watching_channel is not None
|
if watching_channel is not None and watching_channel == channel:
|
||||||
and watching_channel == channel # the watching channel was the one updated
|
|
||||||
and not self.can_watch(channel) # we can't watch it anymore
|
|
||||||
):
|
|
||||||
# NOTE: In these cases, channel was the watching channel
|
# NOTE: In these cases, channel was the watching channel
|
||||||
|
if not self.can_watch(channel):
|
||||||
|
# we can't watch it anymore
|
||||||
if stream_after is None:
|
if stream_after is None:
|
||||||
# Channel going OFFLINE
|
# Channel going OFFLINE
|
||||||
self.print(_("status", "goes_offline").format(channel=channel.name))
|
self.print(_("status", "goes_offline").format(channel=channel.name))
|
||||||
@@ -1132,16 +1129,22 @@ class Twitch:
|
|||||||
f"{stream_after.drops_enabled and '✔' or '❌'})"
|
f"{stream_after.drops_enabled and '✔' or '❌'})"
|
||||||
)
|
)
|
||||||
self.change_state(State.CHANNEL_SWITCH)
|
self.change_state(State.CHANNEL_SWITCH)
|
||||||
|
else:
|
||||||
|
# Channel stays ONLINE, and we can still watch it - no change
|
||||||
|
pass
|
||||||
# NOTE: In these cases, it wasn't the watching channel
|
# NOTE: In these cases, it wasn't the watching channel
|
||||||
elif stream_after is None:
|
elif stream_after is None:
|
||||||
logger.info(f"{channel.name} goes OFFLINE")
|
logger.info(f"{channel.name} goes OFFLINE")
|
||||||
else:
|
else:
|
||||||
# Channel is and stays ONLINE, but has been updated
|
# Channel stays ONLINE, but has been updated
|
||||||
logger.info(
|
logger.info(
|
||||||
f"{channel.name} status has been updated "
|
f"{channel.name} status has been updated "
|
||||||
f"(🎁: {stream_before.drops_enabled and '✔' or '❌'} -> "
|
f"(🎁: {stream_before.drops_enabled and '✔' or '❌'} -> "
|
||||||
f"{stream_after.drops_enabled and '✔' or '❌'})"
|
f"{stream_after.drops_enabled and '✔' or '❌'})"
|
||||||
)
|
)
|
||||||
|
if self.can_watch(channel) and self.should_switch(channel):
|
||||||
|
# ... and we can and should watch it
|
||||||
|
self.watch(channel)
|
||||||
channel.display()
|
channel.display()
|
||||||
|
|
||||||
@task_wrapper
|
@task_wrapper
|
||||||
|
|||||||
Reference in new issue
Block a user