Fix unboundlocalerror
This commit is contained in:
1 parent
5751f96882
commit
73b96185e9
1 file changed
+5
-6
@@ -882,19 +882,20 @@ class Twitch:
|
|||||||
else:
|
else:
|
||||||
# we've removed a channel we were watching
|
# we've removed a channel we were watching
|
||||||
self.stop_watching()
|
self.stop_watching()
|
||||||
|
del new_watching
|
||||||
# pre-display the active drop with a substracted minute
|
# pre-display the active drop with a substracted minute
|
||||||
for channel in channels.values():
|
for channel in channels.values():
|
||||||
# check if there's any channels we can watch first
|
# check if there's any channels we can watch first
|
||||||
if self.can_watch(channel):
|
if self.can_watch(channel):
|
||||||
if (active_drop := self.get_active_drop(channel)) is not None:
|
if (active_drop := self.get_active_drop(channel)) is not None:
|
||||||
active_drop.display(countdown=False, subone=True)
|
active_drop.display(countdown=False, subone=True)
|
||||||
|
del active_drop
|
||||||
break
|
break
|
||||||
self.change_state(State.CHANNEL_SWITCH)
|
self.change_state(State.CHANNEL_SWITCH)
|
||||||
del (
|
del (
|
||||||
no_acl,
|
no_acl,
|
||||||
acl_channels,
|
acl_channels,
|
||||||
new_channels,
|
new_channels,
|
||||||
new_watching,
|
|
||||||
to_add_topics,
|
to_add_topics,
|
||||||
ordered_channels,
|
ordered_channels,
|
||||||
watching_channel,
|
watching_channel,
|
||||||
@@ -917,6 +918,7 @@ 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
|
||||||
|
watching_channel = self.watching_channel.get_with_default(None)
|
||||||
if new_watching is not None:
|
if new_watching is not None:
|
||||||
# if we have a better switch target - do so
|
# if we have a better switch target - do so
|
||||||
self.watch(new_watching)
|
self.watch(new_watching)
|
||||||
@@ -925,21 +927,18 @@ class Twitch:
|
|||||||
)
|
)
|
||||||
# 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()
|
||||||
elif (
|
elif watching_channel is not None:
|
||||||
(watching_channel := self.watching_channel.get_with_default(None)) is not None
|
|
||||||
):
|
|
||||||
# otherwise, continue watching what we had before
|
# otherwise, continue watching what we had before
|
||||||
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()
|
||||||
del watching_channel
|
|
||||||
else:
|
else:
|
||||||
# not watching anything and there isn't anything to watch either
|
# not watching anything and there isn't anything to watch either
|
||||||
self.print(_("status", "no_channel"))
|
self.print(_("status", "no_channel"))
|
||||||
self.change_state(State.IDLE)
|
self.change_state(State.IDLE)
|
||||||
del new_watching, selected_channel
|
del new_watching, selected_channel, watching_channel
|
||||||
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
|
||||||
|
|||||||
Reference in new issue
Block a user