From d693b0890707cd5a225b1603f4d2525eb4c60aff Mon Sep 17 00:00:00 2001 From: Craig Dods Date: Sun, 16 Jul 2023 09:13:11 -0400 Subject: [PATCH] 2 of 2 changes to support bot replays in ggtracker#149 (#2) * 2 of 2 changes to support bot replays in ggtracker#149 Fixes the issue when defaulting to LoTV for GAME_SPEED_FACTOR for bot replays * Update sc2reader/resources.py Co-authored-by: Christian Clauss * Update sc2reader/resources.py Co-authored-by: Christian Clauss * Update sc2reader/resources.py Co-authored-by: Christian Clauss * Update sc2reader/resources.py Co-authored-by: Christian Clauss --------- Co-authored-by: Christian Clauss --- sc2reader/resources.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/sc2reader/resources.py b/sc2reader/resources.py index 428e9cc9..734bc084 100644 --- a/sc2reader/resources.py +++ b/sc2reader/resources.py @@ -429,9 +429,10 @@ def load_details(self): ) self.game_length = self.length + expansion = self.expansion or 'LotV' # Using @brean's logic to fix bot replays self.real_length = utils.Length( seconds=self.length.seconds - // GAME_SPEED_FACTOR[self.expansion].get(self.speed, 1.0) + // GAME_SPEED_FACTOR[expansion].get(self.speed, 1.0) ) self.start_time = datetime.utcfromtimestamp( self.unix_timestamp - self.real_length.seconds @@ -1096,9 +1097,11 @@ def __init__(self, summary_file, filename=None, lang="enUS", **options): self.end_time = datetime.utcfromtimestamp(self.parts[0][8]) self.game_speed = LOBBY_PROPERTIES[0xBB8][1][self.parts[0][0][1].decode("utf8")] self.game_length = utils.Length(seconds=self.parts[0][7]) + expansion = self.expansion or 'LotV' self.real_length = utils.Length( + # Use @brean's logic to fix bot replays seconds=int( - self.parts[0][7] / GAME_SPEED_FACTOR[self.expansion][self.game_speed] + self.parts[0][7] / GAME_SPEED_FACTOR[expansion][self.game_speed] ) ) self.start_time = datetime.utcfromtimestamp(