mirror of
https://github.com/ChuckBuilds/LEDMatrix.git
synced 2026-04-11 21:33:00 +00:00
Add support for extracting count from summary field
This commit is contained in:
@@ -349,6 +349,17 @@ class BaseMLBManager:
|
|||||||
|
|
||||||
# Try alternative locations for count data
|
# Try alternative locations for count data
|
||||||
if balls == 0 and strikes == 0:
|
if balls == 0 and strikes == 0:
|
||||||
|
# First try the summary field
|
||||||
|
if 'summary' in situation:
|
||||||
|
try:
|
||||||
|
count_summary = situation['summary']
|
||||||
|
balls, strikes = map(int, count_summary.split('-'))
|
||||||
|
if is_favorite_game:
|
||||||
|
self.logger.debug(f"[MLB] Using summary count: {count_summary}")
|
||||||
|
except (ValueError, AttributeError):
|
||||||
|
if is_favorite_game:
|
||||||
|
self.logger.debug("[MLB] Could not parse summary count")
|
||||||
|
else:
|
||||||
# Check if count is directly in situation
|
# Check if count is directly in situation
|
||||||
balls = situation.get('balls', 0)
|
balls = situation.get('balls', 0)
|
||||||
strikes = situation.get('strikes', 0)
|
strikes = situation.get('strikes', 0)
|
||||||
|
|||||||
Reference in New Issue
Block a user