mirror of
https://github.com/ChuckBuilds/LEDMatrix.git
synced 2026-04-10 21:03:01 +00:00
update width calculation for leaderboard duration. Reduce log spam
This commit is contained in:
@@ -135,7 +135,7 @@
|
|||||||
"games_per_favorite_team": 1,
|
"games_per_favorite_team": 1,
|
||||||
"max_games_per_league": 5,
|
"max_games_per_league": 5,
|
||||||
"show_odds_only": false,
|
"show_odds_only": false,
|
||||||
"fetch_odds": false,
|
"fetch_odds": true,
|
||||||
"sort_order": "soonest",
|
"sort_order": "soonest",
|
||||||
"enabled_leagues": [
|
"enabled_leagues": [
|
||||||
"nfl",
|
"nfl",
|
||||||
|
|||||||
@@ -919,7 +919,10 @@ class LeaderboardManager:
|
|||||||
logger.info(f"Next league will start at x={current_x}px (gap: {20 + spacing}px)")
|
logger.info(f"Next league will start at x={current_x}px (gap: {20 + spacing}px)")
|
||||||
|
|
||||||
# Set total scroll width for dynamic duration calculation
|
# Set total scroll width for dynamic duration calculation
|
||||||
self.total_scroll_width = total_width
|
# Use actual content width (current_x at end) instead of pre-calculated total_width
|
||||||
|
actual_content_width = current_x - (20 + spacing) # Remove the final spacing that won't be used
|
||||||
|
self.total_scroll_width = actual_content_width
|
||||||
|
logger.info(f"Content width - Calculated: {total_width}px, Actual: {actual_content_width}px")
|
||||||
|
|
||||||
# Log league positioning for debugging and verify layout
|
# Log league positioning for debugging and verify layout
|
||||||
debug_x = 0
|
debug_x = 0
|
||||||
@@ -1050,19 +1053,23 @@ class LeaderboardManager:
|
|||||||
self.dynamic_duration = max(45, int(self.total_scroll_width / 20))
|
self.dynamic_duration = max(45, int(self.total_scroll_width / 20))
|
||||||
logger.debug(f"Adjusted duration for content: {self.dynamic_duration}s (content width: {self.total_scroll_width}px)")
|
logger.debug(f"Adjusted duration for content: {self.dynamic_duration}s (content width: {self.total_scroll_width}px)")
|
||||||
|
|
||||||
logger.debug(f"Leaderboard dynamic duration calculation:")
|
logger.info(f"Leaderboard dynamic duration calculation:")
|
||||||
logger.debug(f" Display width: {display_width}px")
|
logger.info(f" Display width: {display_width}px")
|
||||||
logger.debug(f" Content width: {self.total_scroll_width}px")
|
logger.info(f" Content width: {self.total_scroll_width}px")
|
||||||
logger.debug(f" Total scroll distance: {total_scroll_distance}px")
|
logger.info(f" Total scroll distance: {total_scroll_distance}px")
|
||||||
logger.debug(f" Scroll speed: {self.scroll_speed}px/frame")
|
logger.info(f" Scroll speed: {self.scroll_speed}px/frame")
|
||||||
logger.debug(f" Scroll delay: {self.scroll_delay}s/frame")
|
logger.info(f" Scroll delay: {self.scroll_delay}s/frame")
|
||||||
logger.debug(f" Frames needed: {frames_needed:.1f}")
|
logger.info(f" Frames needed: {frames_needed:.1f}")
|
||||||
logger.debug(f" Base time: {total_time:.2f}s")
|
logger.info(f" Base time: {total_time:.2f}s")
|
||||||
logger.debug(f" Buffer time: {buffer_time:.2f}s ({self.duration_buffer*100}%)")
|
logger.info(f" Buffer time: {buffer_time:.2f}s ({self.duration_buffer*100}%)")
|
||||||
logger.debug(f" Looping enabled: {self.loop}")
|
logger.info(f" Looping enabled: {self.loop}")
|
||||||
logger.debug(f" Calculated duration: {calculated_duration}s")
|
logger.info(f" Calculated duration: {calculated_duration}s")
|
||||||
logger.info(f"Final calculated duration: {self.dynamic_duration}s")
|
logger.info(f"Final calculated duration: {self.dynamic_duration}s")
|
||||||
|
|
||||||
|
# Verify the duration makes sense for the content
|
||||||
|
expected_scroll_time = self.total_scroll_width / (self.scroll_speed / self.scroll_delay)
|
||||||
|
logger.info(f" Verification - Time to scroll content: {expected_scroll_time:.1f}s")
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"Error calculating dynamic duration: {e}")
|
logger.error(f"Error calculating dynamic duration: {e}")
|
||||||
self.dynamic_duration = self.min_duration # Use configured minimum as fallback
|
self.dynamic_duration = self.min_duration # Use configured minimum as fallback
|
||||||
@@ -1218,8 +1225,8 @@ class LeaderboardManager:
|
|||||||
elapsed_time = current_time - self._display_start_time
|
elapsed_time = current_time - self._display_start_time
|
||||||
remaining_time = self.dynamic_duration - elapsed_time
|
remaining_time = self.dynamic_duration - elapsed_time
|
||||||
|
|
||||||
# Log scroll progress every 10 seconds to help debug
|
# Log scroll progress every 50 pixels to help debug (less verbose)
|
||||||
if int(elapsed_time) % 10 == 0 and elapsed_time > 0:
|
if self.scroll_position % 50 == 0 and self.scroll_position > 0:
|
||||||
logger.info(f"Leaderboard progress: elapsed={elapsed_time:.1f}s, remaining={remaining_time:.1f}s, scroll_pos={self.scroll_position}/{self.leaderboard_image.width}px")
|
logger.info(f"Leaderboard progress: elapsed={elapsed_time:.1f}s, remaining={remaining_time:.1f}s, scroll_pos={self.scroll_position}/{self.leaderboard_image.width}px")
|
||||||
|
|
||||||
# If we have less than 2 seconds remaining and we're not at a clean break point,
|
# If we have less than 2 seconds remaining and we're not at a clean break point,
|
||||||
|
|||||||
@@ -1667,8 +1667,8 @@ class OddsTickerManager:
|
|||||||
elapsed_time = current_time - self._display_start_time
|
elapsed_time = current_time - self._display_start_time
|
||||||
remaining_time = self.dynamic_duration - elapsed_time
|
remaining_time = self.dynamic_duration - elapsed_time
|
||||||
|
|
||||||
# Log timing info every 10 seconds to help debug
|
# Log timing info every 50 pixels to help debug (less verbose)
|
||||||
if int(elapsed_time) % 10 == 0 and elapsed_time > 0:
|
if self.scroll_position % 50 == 0 and self.scroll_position > 0:
|
||||||
logger.info(f"Odds ticker timing: elapsed={elapsed_time:.1f}s, remaining={remaining_time:.1f}s, duration={self.dynamic_duration}s, scroll_pos={self.scroll_position}")
|
logger.info(f"Odds ticker timing: elapsed={elapsed_time:.1f}s, remaining={remaining_time:.1f}s, duration={self.dynamic_duration}s, scroll_pos={self.scroll_position}")
|
||||||
|
|
||||||
# If we have less than 2 seconds remaining and we're not at a clean break point,
|
# If we have less than 2 seconds remaining and we're not at a clean break point,
|
||||||
|
|||||||
Reference in New Issue
Block a user