Fix an issue with reload stopping the watching

This commit is contained in:
DevilXD committed 2022-04-07 17:49:03 +02:00
1 parent dbb27e186d
commit c9502c1f3e
1 file changed
+10 -5
+10 -5
View File
@@ -364,15 +364,20 @@ class Twitch:
if self.can_watch(channel) and self.should_switch(channel): if self.can_watch(channel) and self.should_switch(channel):
new_watching = channel new_watching = channel
break break
if new_watching is not None: watching_channel = self.watching_channel.get_with_default(None)
self.watch(channel) if watching_channel is None and new_watching is None:
# break the state change chain by clearing the flag # not watching anything and there isn't anything to watch either
self._state_change.clear()
else:
self.gui.print( self.gui.print(
"No available channels to watch. Waiting for an ONLINE channel..." "No available channels to watch. Waiting for an ONLINE channel..."
) )
self.change_state(State.IDLE) self.change_state(State.IDLE)
else:
if new_watching is not None:
# if we have a better switch target - do so
# otherwise, continue watching what we had before
self.watch(new_watching)
# break the state change chain by clearing the flag
self._state_change.clear()
elif self._state is State.EXIT: elif self._state is State.EXIT:
# we've been requested to exit the application # we've been requested to exit the application
break break