More accurate active drop pre-display

This commit is contained in:
DevilXD committed 2022-01-16 23:10:52 +01:00
1 parent 365a702d8a
commit 3a05e5e104
3 files changed
+14 -5

No files matched your search

+6 -3
View File
@@ -437,7 +437,7 @@ class CampaignProgress:
self._timer_task.cancel()
self._timer_task = None
def display(self, drop: TimedDrop, *, countdown: bool = True):
def display(self, drop: TimedDrop, *, countdown: bool = True, subone: bool = False):
self._drop = drop
# drop update
vars_drop = self._vars["drop"]
@@ -459,11 +459,14 @@ class CampaignProgress:
# reschedule our seconds update timer
self.stop_timer()
self.start_timer()
else:
elif subone:
# display the current remaining time at 0 seconds (after substracting the minute)
# this is because the watch loop will substract this minute
# right after the first watch payload is sent
# right after the first watch payload returns with a time update
self._update_time(0)
else:
# display full time with no substracting
self._update_time(60)
class ConsoleOutput:
+2 -2
View File
@@ -174,8 +174,8 @@ class TimedDrop(BaseDrop):
self.current_minutes = minutes
self._on_minutes_changed()
def display(self, *, countdown: bool = True):
self.campaign._twitch.gui.progress.display(self, countdown=countdown)
def display(self, *, countdown: bool = True, subone: bool = False):
self.campaign._twitch.gui.progress.display(self, countdown=countdown, subone=subone)
def bump_minutes(self):
if self.current_minutes < self.required_minutes:
+6
View File
@@ -266,6 +266,12 @@ class Twitch:
live_streams: List[Channel] = await self.get_live_streams(
selected_game, [DROPS_ENABLED_TAG]
)
if live_streams:
# there are online streams, so let's pre-display the active drop again,
# but this time with a substracted minute
active_drop = self.get_active_drop(selected_game)
if active_drop is not None:
active_drop.display(countdown=False, subone=True)
# add them, filtering out ones we already have
for channel in live_streams:
if channel.id not in self.channels: