diff --git a/services/espn_api.py b/services/espn_api.py index d3ca70e..6aa20d7 100644 --- a/services/espn_api.py +++ b/services/espn_api.py @@ -139,25 +139,32 @@ class ESPNAPI: # Extract team information and game status competition = event['competitions'][0] competitors = competition['competitors'] - + # Get game status information status = competition.get('status', {}) game_state = status.get('type', {}).get('state', 'pre') # pre, in, post is_live = game_state == 'in' status_display = status.get('type', {}).get('name', 'Scheduled') - + home_team = None away_team = None - - # Identify home and away teams + home_score = None + away_score = None + + # Identify home and away teams and extract scores for comp in competitors: team_abbrev = comp['team']['abbreviation'] # Normalize team abbreviation to match Sleeper format normalized_team = self.normalize_team_abbreviation(team_abbrev) + # Get score if available + score = comp.get('score') + if comp['homeAway'] == 'home': home_team = normalized_team + home_score = score else: away_team = normalized_team + away_score = score print(f"ESPN API: {away_team} @ {home_team} at {game_date_local.strftime('%I:%M %p')} {tz_abbr}", flush=True) @@ -170,6 +177,8 @@ class ESPNAPI: 'time': f"{game_date_local.strftime('%I:%M %p')} {tz_abbr}", 'home_team': home_team, 'away_team': away_team, + 'home_score': home_score, + 'away_score': away_score, 'teams': [home_team, away_team], 'is_past': game_date_local < (debug_current_time.astimezone(game_date_local.tzinfo) if debug_current_time else datetime.now(game_date_local.tzinfo)), 'is_live': is_live, diff --git a/static/style.css b/static/style.css index 76c8d68..7ab4e2c 100644 --- a/static/style.css +++ b/static/style.css @@ -426,6 +426,14 @@ color: var(--text-primary); } +.nfl-score { + color: var(--accent); + font-weight: 700; + font-size: 15px; + min-width: 20px; + text-align: center; +} + .at { color: var(--text-muted); font-size: 12px; diff --git a/templates/dashboard.html b/templates/dashboard.html index 2e35d3f..5c8d265 100644 --- a/templates/dashboard.html +++ b/templates/dashboard.html @@ -132,7 +132,13 @@
{{ game.away_team }} + {% if game.away_score is not none %} + {{ game.away_score }} + {% endif %} @ + {% if game.home_score is not none %} + {{ game.home_score }} + {% endif %} {{ game.home_team }}
{% if game.is_past and not game.is_live %}▶{% else %}▼{% endif %}