Fix an issue with the miner not switching away from an invalidated channel
This commit is contained in:
1 parent
f96f87bd2d
commit
ca10aeeef9
2 files changed
+8
-6
No files matched your search
+1
-1
@@ -298,7 +298,7 @@ class TimedDrop(BaseDrop):
|
|||||||
self._twitch.gui.inv.update_drop(self)
|
self._twitch.gui.inv.update_drop(self)
|
||||||
|
|
||||||
def _update_real_minutes(self, delta: int) -> None:
|
def _update_real_minutes(self, delta: int) -> None:
|
||||||
if delta == 0 or self.real_current_minutes + delta < 0 or not self.can_earn():
|
if delta == 0 or self.real_current_minutes + delta < 0:
|
||||||
return
|
return
|
||||||
if self.real_current_minutes + delta < self.required_minutes:
|
if self.real_current_minutes + delta < self.required_minutes:
|
||||||
self.real_current_minutes += delta
|
self.real_current_minutes += delta
|
||||||
|
|||||||
@@ -845,7 +845,7 @@ class Twitch:
|
|||||||
# NOTE: we need to sort the channels every time because one channel
|
# NOTE: we need to sort the channels every time because one channel
|
||||||
# can end up streaming any game - channels aren't game-tied
|
# can end up streaming any game - channels aren't game-tied
|
||||||
for channel in sorted(channels.values(), key=self.get_priority):
|
for channel in sorted(channels.values(), key=self.get_priority):
|
||||||
if self.can_watch(channel) and self.should_switch(channel):
|
if self.should_switch(channel):
|
||||||
new_watching = channel
|
new_watching = channel
|
||||||
break
|
break
|
||||||
watching_channel = self.watching_channel.get_with_default(None)
|
watching_channel = self.watching_channel.get_with_default(None)
|
||||||
@@ -1003,8 +1003,10 @@ class Twitch:
|
|||||||
"""
|
"""
|
||||||
Determines if the given channel qualifies as a switch candidate.
|
Determines if the given channel qualifies as a switch candidate.
|
||||||
"""
|
"""
|
||||||
|
if not self.can_watch(channel):
|
||||||
|
return False
|
||||||
watching_channel = self.watching_channel.get_with_default(None)
|
watching_channel = self.watching_channel.get_with_default(None)
|
||||||
if watching_channel is None:
|
if watching_channel is None or not self.can_watch(watching_channel):
|
||||||
return True
|
return True
|
||||||
channel_order = self.get_priority(channel)
|
channel_order = self.get_priority(channel)
|
||||||
watching_order = self.get_priority(watching_channel)
|
watching_order = self.get_priority(watching_channel)
|
||||||
@@ -1099,7 +1101,7 @@ 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 self.can_watch(channel) and self.should_switch(channel):
|
if self.should_switch(channel):
|
||||||
# we can watch the channel, and we should
|
# we can watch the 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)
|
||||||
@@ -1139,8 +1141,8 @@ class Twitch:
|
|||||||
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):
|
if self.should_switch(channel):
|
||||||
# ... and we can and should watch it
|
# ... and we should watch it
|
||||||
self.watch(channel)
|
self.watch(channel)
|
||||||
channel.display()
|
channel.display()
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user