mirror of
https://github.com/ChuckBuilds/LEDMatrix.git
synced 2026-04-11 13:23:00 +00:00
added espn api logging
This commit is contained in:
@@ -217,6 +217,8 @@ class BaseMLBManager:
|
|||||||
response.raise_for_status()
|
response.raise_for_status()
|
||||||
|
|
||||||
data = response.json()
|
data = response.json()
|
||||||
|
self.logger.debug(f"Raw API response: {data}") # Log raw response
|
||||||
|
|
||||||
games = {}
|
games = {}
|
||||||
|
|
||||||
for event in data.get('events', []):
|
for event in data.get('events', []):
|
||||||
@@ -228,6 +230,11 @@ class BaseMLBManager:
|
|||||||
home_team = next(c for c in competitors if c['homeAway'] == 'home')
|
home_team = next(c for c in competitors if c['homeAway'] == 'home')
|
||||||
away_team = next(c for c in competitors if c['homeAway'] == 'away')
|
away_team = next(c for c in competitors if c['homeAway'] == 'away')
|
||||||
|
|
||||||
|
# Log team abbreviations we're getting
|
||||||
|
home_abbr = home_team['team']['abbreviation']
|
||||||
|
away_abbr = away_team['team']['abbreviation']
|
||||||
|
self.logger.info(f"Found game: {away_abbr} @ {home_abbr} (Status: {status})")
|
||||||
|
|
||||||
# Get game state information
|
# Get game state information
|
||||||
if status == 'in':
|
if status == 'in':
|
||||||
# For live games, get detailed state
|
# For live games, get detailed state
|
||||||
@@ -255,8 +262,8 @@ class BaseMLBManager:
|
|||||||
bases_occupied = [False, False, False]
|
bases_occupied = [False, False, False]
|
||||||
|
|
||||||
games[game_id] = {
|
games[game_id] = {
|
||||||
'away_team': away_team['team']['abbreviation'],
|
'away_team': away_abbr,
|
||||||
'home_team': home_team['team']['abbreviation'],
|
'home_team': home_abbr,
|
||||||
'away_score': away_team['score'],
|
'away_score': away_team['score'],
|
||||||
'home_score': home_team['score'],
|
'home_score': home_team['score'],
|
||||||
'status': status,
|
'status': status,
|
||||||
@@ -268,6 +275,12 @@ class BaseMLBManager:
|
|||||||
'start_time': event['date']
|
'start_time': event['date']
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Log what teams we're looking for vs what we found
|
||||||
|
self.logger.info(f"Looking for favorite teams: {self.favorite_teams}")
|
||||||
|
found_teams = set([game['home_team'] for game in games.values()] +
|
||||||
|
[game['away_team'] for game in games.values()])
|
||||||
|
self.logger.info(f"Found teams in API response: {found_teams}")
|
||||||
|
|
||||||
# Cache the results with different expiration times based on game status
|
# Cache the results with different expiration times based on game status
|
||||||
cache_duration = 300 # 5 minutes for live games
|
cache_duration = 300 # 5 minutes for live games
|
||||||
if not any(game['status'] == 'in' for game in games.values()):
|
if not any(game['status'] == 'in' for game in games.values()):
|
||||||
|
|||||||
@@ -479,7 +479,7 @@ class StockManager:
|
|||||||
# Calculate chart dimensions
|
# Calculate chart dimensions
|
||||||
chart_width = int(width // 2.5) # Reduced from width//2.5 to prevent overlap
|
chart_width = int(width // 2.5) # Reduced from width//2.5 to prevent overlap
|
||||||
chart_height = height // 1.5
|
chart_height = height // 1.5
|
||||||
chart_x = width - chart_width - 4 # 14px margin from right edge
|
chart_x = width - chart_width - 4 # 4px margin from right edge
|
||||||
chart_y = (height - chart_height) // 2
|
chart_y = (height - chart_height) // 2
|
||||||
|
|
||||||
# Find min and max prices for scaling
|
# Find min and max prices for scaling
|
||||||
|
|||||||
Reference in New Issue
Block a user