more robust half time detection

This commit is contained in:
Chuck
2025-08-09 20:06:25 -05:00
parent 938c31c815
commit 6a2e5edf2e
3 changed files with 5 additions and 5 deletions

View File

@@ -438,7 +438,7 @@ class BaseNCAAFBManager: # Renamed class
elif period == 4: period_text = "Q3" elif period == 4: period_text = "Q3"
elif period == 5: period_text = "Q4" elif period == 5: period_text = "Q4"
elif period > 5: period_text = "OT" # Assuming OT starts at period 6+ elif period > 5: period_text = "OT" # Assuming OT starts at period 6+
elif status["type"]["state"] == "halftime": # Check explicit halftime state elif status["type"]["state"] == "halftime" or status["type"]["name"] == "STATUS_HALFTIME": # Check explicit halftime state
period_text = "HALF" period_text = "HALF"
elif status["type"]["state"] == "post": elif status["type"]["state"] == "post":
if period > 5 : period_text = "Final/OT" if period > 5 : period_text = "Final/OT"
@@ -466,7 +466,7 @@ class BaseNCAAFBManager: # Renamed class
"is_live": status["type"]["state"] == "in", "is_live": status["type"]["state"] == "in",
"is_final": status["type"]["state"] == "post", "is_final": status["type"]["state"] == "post",
"is_upcoming": status["type"]["state"] == "pre", "is_upcoming": status["type"]["state"] == "pre",
"is_halftime": status["type"]["state"] == "halftime", # Added halftime check "is_halftime": status["type"]["state"] == "halftime" or status["type"]["name"] == "STATUS_HALFTIME", # Added halftime check
"home_abbr": home_abbr, "home_abbr": home_abbr,
"home_score": home_team.get("score", "0"), "home_score": home_team.get("score", "0"),
"home_record": home_record, "home_record": home_record,

View File

@@ -396,7 +396,7 @@ class BaseNCAAMBasketballManager:
"period": status.get("period", 0), "period": status.get("period", 0),
"clock": status.get("displayClock", "0:00"), "clock": status.get("displayClock", "0:00"),
"is_live": status["type"]["state"] in ("in", "halftime"), # Include halftime as live "is_live": status["type"]["state"] in ("in", "halftime"), # Include halftime as live
"is_halftime": status["type"]["state"] == "halftime", "is_halftime": status["type"]["state"] == "halftime" or status["type"]["name"] == "STATUS_HALFTIME",
"is_final": status["type"]["state"] == "post", "is_final": status["type"]["state"] == "post",
"is_upcoming": status["type"]["state"] == "pre", "is_upcoming": status["type"]["state"] == "pre",
"home_abbr": home_team["team"]["abbreviation"], "home_abbr": home_team["team"]["abbreviation"],

View File

@@ -382,7 +382,7 @@ class BaseNFLManager: # Renamed class
elif period == 3: period_text = "Q3" # Fixed: period 3 is 3rd quarter, not halftime elif period == 3: period_text = "Q3" # Fixed: period 3 is 3rd quarter, not halftime
elif period == 4: period_text = "Q4" elif period == 4: period_text = "Q4"
elif period > 4: period_text = "OT" # OT starts after Q4 elif period > 4: period_text = "OT" # OT starts after Q4
elif status["type"]["state"] == "halftime": # Check explicit halftime state elif status["type"]["state"] == "halftime" or status["type"]["name"] == "STATUS_HALFTIME": # Check explicit halftime state
period_text = "HALF" period_text = "HALF"
elif status["type"]["state"] == "post": elif status["type"]["state"] == "post":
if period > 4 : period_text = "Final/OT" if period > 4 : period_text = "Final/OT"
@@ -407,7 +407,7 @@ class BaseNFLManager: # Renamed class
"is_live": status["type"]["state"] == "in", "is_live": status["type"]["state"] == "in",
"is_final": status["type"]["state"] == "post", "is_final": status["type"]["state"] == "post",
"is_upcoming": status["type"]["state"] == "pre", "is_upcoming": status["type"]["state"] == "pre",
"is_halftime": status["type"]["state"] == "halftime", # Added halftime check "is_halftime": status["type"]["state"] == "halftime" or status["type"]["name"] == "STATUS_HALFTIME", # Added halftime check
"home_abbr": home_abbr, "home_abbr": home_abbr,
"home_score": home_team.get("score", "0"), "home_score": home_team.get("score", "0"),
"home_record": home_record, "home_record": home_record,