scores.mlb: account for upstream API change for suspended games (#820)

This commit is contained in:
Erik Johnson 2021-06-26 19:57:13 -05:00 committed by GitHub
parent cfd60a6bb0
commit d0912be27e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -283,8 +283,12 @@ class MLB(ScoresBackend):
ret['delay'] = game['status']['detailedState'].split(':', 1)[-1].strip()
elif ret['status'] == 'postponed':
ret['postponed'] = self.get_nested(game, 'status:reason', default='Unknown Reason')
elif ret['status'] == 'suspended':
ret['suspended'] = self.get_nested(game, 'status:reason', default='Unknown Reason')
elif ret['status'].startswith('suspended'):
ret['status'] = 'suspended'
ret['suspended'] = self.get_nested(
game,
'status:detailedState',
default='Suspended').replace('Suspended: ', '')
elif ret['status'].startswith('completed_early') or ret['status'] == 'game_over':
ret['status'] = 'final'
elif ret['status'] not in ('in_progress', 'final'):