Add a missing status update in on_online;
redesign the watching status if statement
This commit is contained in:
1 parent
1f4a177906
commit
c665d81f70
1 file changed
+18
-13
@@ -379,23 +379,25 @@ class Twitch:
|
|||||||
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)
|
||||||
if watching_channel is None and new_watching is None:
|
if new_watching is not None:
|
||||||
# not watching anything and there isn't anything to watch either
|
# if we have a better switch target - do so
|
||||||
self.gui.print(_("status", "no_channel"))
|
self.watch(new_watching)
|
||||||
self.change_state(State.IDLE)
|
self.gui.status.update(
|
||||||
else:
|
_("gui", "status", "watching").format(channel=new_watching.name)
|
||||||
if new_watching is not None:
|
)
|
||||||
# if we have a better switch target - do so
|
# break the state change chain by clearing the flag
|
||||||
# otherwise, continue watching what we had before
|
self._state_change.clear()
|
||||||
self.watch(new_watching)
|
elif watching_channel is not None:
|
||||||
# should immediately complete, since we'll definitely
|
# otherwise, continue watching what we had before
|
||||||
# have a channel we're watching here
|
|
||||||
watching_channel = await self.watching_channel.get()
|
|
||||||
self.gui.status.update(
|
self.gui.status.update(
|
||||||
_("gui", "status", "watching").format(channel=watching_channel.name)
|
_("gui", "status", "watching").format(channel=watching_channel.name)
|
||||||
)
|
)
|
||||||
# break the state change chain by clearing the flag
|
# break the state change chain by clearing the flag
|
||||||
self._state_change.clear()
|
self._state_change.clear()
|
||||||
|
else:
|
||||||
|
# not watching anything and there isn't anything to watch either
|
||||||
|
self.gui.print(_("status", "no_channel"))
|
||||||
|
self.change_state(State.IDLE)
|
||||||
elif self._state is State.EXIT:
|
elif self._state is State.EXIT:
|
||||||
self.gui.status.update(_("gui", "status", "exiting"))
|
self.gui.status.update(_("gui", "status", "exiting"))
|
||||||
# we've been requested to exit the application
|
# we've been requested to exit the application
|
||||||
@@ -580,8 +582,11 @@ class Twitch:
|
|||||||
self.can_watch(channel) # we can watch the channel that just got ONLINE
|
self.can_watch(channel) # we can watch the channel that just got ONLINE
|
||||||
and self.should_switch(channel) # and we should!
|
and self.should_switch(channel) # and we should!
|
||||||
):
|
):
|
||||||
self.gui.print(_("status", "goes_online").format(channel=channel.name))
|
|
||||||
self.watch(channel)
|
self.watch(channel)
|
||||||
|
self.gui.print(_("status", "goes_online").format(channel=channel.name))
|
||||||
|
self.gui.status.update(
|
||||||
|
_("gui", "status", "watching").format(channel=channel.name)
|
||||||
|
)
|
||||||
|
|
||||||
def on_offline(self, channel: Channel):
|
def on_offline(self, channel: Channel):
|
||||||
"""
|
"""
|
||||||
|
|||||||
Reference in new issue
Block a user