mirror of
https://github.com/ChuckBuilds/LEDMatrix.git
synced 2026-04-10 21:03:01 +00:00
logging for why milb api isn't working and cache updates to odds cache storage
This commit is contained in:
@@ -413,6 +413,15 @@ class BaseMiLBManager:
|
||||
else:
|
||||
home_record_str = ''
|
||||
|
||||
# --- TEMP: Comprehensive Debugging ---
|
||||
self.logger.info(f"[MiLB DEBUG] Raw event data for game {game_pk}:\n{json.dumps(event, indent=2)}")
|
||||
|
||||
game_date = event.get('gameDate')
|
||||
if not game_date:
|
||||
self.logger.warning(f"Skipping game {game_pk} due to missing 'gameDate'.")
|
||||
continue
|
||||
# --- End of TEMP Debugging ---
|
||||
|
||||
is_favorite_game = (home_abbr in self.favorite_teams or away_abbr in self.favorite_teams)
|
||||
|
||||
if not self.favorite_teams or is_favorite_game:
|
||||
|
||||
@@ -60,7 +60,7 @@ class BaseNFLManager: # Renamed class
|
||||
self.upcoming_enabled = display_modes.get("nfl_upcoming", False)
|
||||
self.live_enabled = display_modes.get("nfl_live", False)
|
||||
|
||||
self.logger.setLevel(logging.DEBUG)
|
||||
self.logger.setLevel(logging.INFO)
|
||||
|
||||
display_config = config.get("display", {})
|
||||
hardware_config = display_config.get("hardware", {})
|
||||
|
||||
@@ -16,8 +16,8 @@ class OddsManager:
|
||||
def get_odds(self, sport: str, league: str, event_id: str, update_interval_seconds=3600):
|
||||
cache_key = f"odds_espn_{sport}_{league}_{event_id}"
|
||||
|
||||
# Check cache first with 1-hour update interval
|
||||
cached_data = self.cache_manager.get(cache_key)
|
||||
# Check cache first
|
||||
cached_data = self.cache_manager.get_with_auto_strategy(cache_key)
|
||||
|
||||
if cached_data:
|
||||
self.logger.info(f"Using cached odds from ESPN for {cache_key}")
|
||||
@@ -37,12 +37,12 @@ class OddsManager:
|
||||
self.logger.info(f"Extracted odds data: {odds_data}")
|
||||
|
||||
if odds_data:
|
||||
self.cache_manager.update_cache(cache_key, odds_data)
|
||||
self.cache_manager.set(cache_key, odds_data)
|
||||
self.logger.info(f"Saved odds data to cache for {cache_key}")
|
||||
else:
|
||||
self.logger.warning(f"No odds data extracted for {cache_key}")
|
||||
# Cache the fact that no odds are available to avoid repeated API calls
|
||||
self.cache_manager.update_cache(cache_key, {"no_odds": True})
|
||||
self.cache_manager.set(cache_key, {"no_odds": True})
|
||||
|
||||
return odds_data
|
||||
|
||||
@@ -51,7 +51,7 @@ class OddsManager:
|
||||
except json.JSONDecodeError:
|
||||
self.logger.error(f"Error decoding JSON response from ESPN API for {cache_key}.")
|
||||
|
||||
return self.cache_manager.get(cache_key)
|
||||
return self.cache_manager.get_with_auto_strategy(cache_key)
|
||||
|
||||
def _extract_espn_data(self, data: Dict[str, Any]) -> Optional[Dict[str, Any]]:
|
||||
self.logger.debug(f"Extracting ESPN odds data. Data keys: {list(data.keys())}")
|
||||
|
||||
Reference in New Issue
Block a user