i3pystatus.scores.nba: Fix spurious log warning for games that haven't started (#827)
This commit is contained in:
parent
48775e4b87
commit
8476fd6a35
@ -232,19 +232,20 @@ class NBA(ScoresBackend):
|
|||||||
ret['quarter'] = ''
|
ret['quarter'] = ''
|
||||||
|
|
||||||
clock = game.get('gameClock', '')
|
clock = game.get('gameClock', '')
|
||||||
try:
|
ret['time_remaining'] = ''
|
||||||
mins, secs = re.match(r'^PT(\d+)M(\d+\.\d)0?S$', clock).groups()
|
if clock:
|
||||||
except AttributeError:
|
try:
|
||||||
ret['time_remaining'] = ''
|
mins, secs = re.match(r'^PT(\d+)M(\d+\.\d)0?S$', clock).groups()
|
||||||
self.logger.warning('Failed to parse gameClock value: {clock}')
|
except AttributeError:
|
||||||
else:
|
self.logger.warning(f'Failed to parse gameClock value: {clock}')
|
||||||
mins = mins.lstrip('0')
|
|
||||||
if mins:
|
|
||||||
secs = secs.split('.')[0]
|
|
||||||
if not mins and secs == '00.0':
|
|
||||||
ret['time_remaining'] = 'End'
|
|
||||||
else:
|
else:
|
||||||
ret['time_remaining'] = f'{mins}:{secs}'
|
mins = mins.lstrip('0')
|
||||||
|
if mins:
|
||||||
|
secs = secs.split('.')[0]
|
||||||
|
if not mins and secs == '00.0':
|
||||||
|
ret['time_remaining'] = 'End'
|
||||||
|
else:
|
||||||
|
ret['time_remaining'] = f'{mins}:{secs}'
|
||||||
|
|
||||||
ret['overtime'] = ret['quarter'] if 'OT' in ret['quarter'] else ''
|
ret['overtime'] = ret['quarter'] if 'OT' in ret['quarter'] else ''
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user