diff --git a/src/odds_manager.py b/src/odds_manager.py index 6f80e8c6..705d60f6 100644 --- a/src/odds_manager.py +++ b/src/odds_manager.py @@ -56,13 +56,16 @@ class OddsManager: self.logger.debug(f"Received raw odds data from ESPN: {json.dumps(raw_data, indent=2)}") odds_data = self._extract_espn_data(raw_data) - self.logger.info(f"Extracted odds data: {odds_data}") + if odds_data: + self.logger.info(f"Successfully extracted odds data: {odds_data}") + else: + self.logger.debug("No odds data available for this game") if 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}") + self.logger.debug(f"No odds data available for {cache_key}") # Cache the fact that no odds are available to avoid repeated API calls self.cache_manager.set(cache_key, {"no_odds": True}) @@ -101,7 +104,13 @@ class OddsManager: self.logger.debug(f"Returning extracted odds data: {json.dumps(extracted_data, indent=2)}") return extracted_data - # Log the actual response structure when no items are found - self.logger.warning("No 'items' found in ESPN odds data.") - self.logger.warning(f"Actual response structure: {json.dumps(data, indent=2)}") - return None \ No newline at end of file + # Check if this is a valid empty response or an unexpected structure + if "count" in data and data["count"] == 0 and "items" in data and data["items"] == []: + # This is a valid empty response - no odds available for this game + self.logger.debug(f"No odds available for this game. Response: {json.dumps(data, indent=2)}") + return None + else: + # This is an unexpected response structure + self.logger.warning("No 'items' found in ESPN odds data.") + self.logger.warning(f"Unexpected response structure: {json.dumps(data, indent=2)}") + return None \ No newline at end of file diff --git a/src/odds_ticker_manager.py b/src/odds_ticker_manager.py index ddcabb73..4b4bc22c 100644 --- a/src/odds_ticker_manager.py +++ b/src/odds_ticker_manager.py @@ -1491,9 +1491,9 @@ class OddsTickerManager: return gap_width = 24 # Reduced gap between games - display_width = self.display_manager.matrix.width # Add display width of black space at start + display_width = self.display_manager.matrix.width # Add display width of black space at start and end content_width = sum(img.width for img in game_images) + gap_width * (len(game_images)) - total_width = display_width + content_width + total_width = display_width + content_width + display_width # Add display width at both start and end height = self.display_manager.matrix.height logger.debug(f"Image creation details:") @@ -1519,7 +1519,7 @@ class OddsTickerManager: # Calculate total scroll width for dynamic duration (only the content width, not including display width) self.total_scroll_width = content_width logger.debug(f"Odds ticker image creation:") - logger.debug(f" Display width: {display_width}px") + logger.debug(f" Display width: {display_width}px (added at start and end)") logger.debug(f" Content width: {content_width}px") logger.debug(f" Total image width: {total_width}px") logger.debug(f" Number of games: {len(game_images)}")