mirror of
https://github.com/ChuckBuilds/LEDMatrix.git
synced 2026-04-10 21:03:01 +00:00
add black buffer behind odds ticker to finish scroll
This commit is contained in:
@@ -56,13 +56,16 @@ class OddsManager:
|
|||||||
self.logger.debug(f"Received raw odds data from ESPN: {json.dumps(raw_data, indent=2)}")
|
self.logger.debug(f"Received raw odds data from ESPN: {json.dumps(raw_data, indent=2)}")
|
||||||
|
|
||||||
odds_data = self._extract_espn_data(raw_data)
|
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:
|
if odds_data:
|
||||||
self.cache_manager.set(cache_key, odds_data)
|
self.cache_manager.set(cache_key, odds_data)
|
||||||
self.logger.info(f"Saved odds data to cache for {cache_key}")
|
self.logger.info(f"Saved odds data to cache for {cache_key}")
|
||||||
else:
|
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
|
# Cache the fact that no odds are available to avoid repeated API calls
|
||||||
self.cache_manager.set(cache_key, {"no_odds": True})
|
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)}")
|
self.logger.debug(f"Returning extracted odds data: {json.dumps(extracted_data, indent=2)}")
|
||||||
return extracted_data
|
return extracted_data
|
||||||
|
|
||||||
# Log the actual response structure when no items are found
|
# Check if this is a valid empty response or an unexpected structure
|
||||||
self.logger.warning("No 'items' found in ESPN odds data.")
|
if "count" in data and data["count"] == 0 and "items" in data and data["items"] == []:
|
||||||
self.logger.warning(f"Actual response structure: {json.dumps(data, indent=2)}")
|
# This is a valid empty response - no odds available for this game
|
||||||
return None
|
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
|
||||||
@@ -1491,9 +1491,9 @@ class OddsTickerManager:
|
|||||||
return
|
return
|
||||||
|
|
||||||
gap_width = 24 # Reduced gap between games
|
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))
|
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
|
height = self.display_manager.matrix.height
|
||||||
|
|
||||||
logger.debug(f"Image creation details:")
|
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)
|
# Calculate total scroll width for dynamic duration (only the content width, not including display width)
|
||||||
self.total_scroll_width = content_width
|
self.total_scroll_width = content_width
|
||||||
logger.debug(f"Odds ticker image creation:")
|
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" Content width: {content_width}px")
|
||||||
logger.debug(f" Total image width: {total_width}px")
|
logger.debug(f" Total image width: {total_width}px")
|
||||||
logger.debug(f" Number of games: {len(game_images)}")
|
logger.debug(f" Number of games: {len(game_images)}")
|
||||||
|
|||||||
Reference in New Issue
Block a user