Switch to IDLE after cleanup, not game select

This commit is contained in:
DevilXD committed 2022-02-26 19:41:30 +01:00
1 parent ed81d6abc8
commit 03536d8344
1 file changed
+9 -8
+9 -8
View File
@@ -225,14 +225,11 @@ class Twitch:
else: else:
self.game = self.gui.games.set_first() self.game = self.gui.games.set_first()
if self.game is not None: if self.game is not None:
# restart the watch loop if needed # restart the watch loop immediately on new game selected
self.restart_watching() self.restart_watching()
# signal channel cleanup that we're removing everything # signal channel cleanup that we're removing everything
full_cleanup = True full_cleanup = True
self.change_state(State.CHANNELS_CLEANUP) self.change_state(State.CHANNELS_CLEANUP)
else:
# with no game selected, we switch to IDLE
self.change_state(State.IDLE)
elif self._state is State.CHANNELS_CLEANUP: elif self._state is State.CHANNELS_CLEANUP:
if self.game is None or full_cleanup: if self.game is None or full_cleanup:
# no game selected or we're doing full cleanup: remove everything # no game selected or we're doing full cleanup: remove everything
@@ -260,7 +257,11 @@ class Twitch:
for channel in to_remove: for channel in to_remove:
del channels[channel.id] del channels[channel.id]
channel.remove() channel.remove()
self.change_state(State.CHANNELS_FETCH) if self.game is not None:
self.change_state(State.CHANNELS_FETCH)
else:
# with no game selected, we switch to IDLE after cleanup
self.change_state(State.IDLE)
elif self._state is State.CHANNELS_FETCH: elif self._state is State.CHANNELS_FETCH:
if self.game is None: if self.game is None:
self.change_state(State.GAME_SELECT) self.change_state(State.GAME_SELECT)