diff --git a/src/leaderboard_manager.py b/src/leaderboard_manager.py index 7b6110e8..287a6435 100644 --- a/src/leaderboard_manager.py +++ b/src/leaderboard_manager.py @@ -940,13 +940,13 @@ class LeaderboardManager: # and add extra time to ensure we don't cut off mid-scroll if self.loop: # Add extra buffer for looping to ensure smooth transition - # Use a more reasonable buffer to prevent excessive looping - loop_buffer = total_time * 0.15 # 15% extra for looping (reduced from 30%) + # Use a more generous buffer to ensure complete content display + loop_buffer = total_time * 0.2 # 20% extra for looping (increased from 15%) calculated_duration = int(total_time + buffer_time + loop_buffer) logger.debug(f"Looping enabled, added {loop_buffer:.2f}s loop buffer") else: # Even without looping, add extra buffer to ensure complete display - extra_buffer = total_time * 0.1 # 10% extra to ensure complete content display (reduced from 15%) + extra_buffer = total_time * 0.15 # 15% extra to ensure complete content display (increased from 10%) calculated_duration = int(total_time + buffer_time + extra_buffer) logger.debug(f"No looping, added {extra_buffer:.2f}s extra buffer for complete display") @@ -962,10 +962,11 @@ class LeaderboardManager: # Additional safety check: if the calculated duration seems too short for the content, # ensure we have enough time to display all content properly - if self.dynamic_duration < 30 and self.total_scroll_width > 800: - # If we have a lot of content but short duration, increase it - self.dynamic_duration = max(30, int(self.total_scroll_width / 30)) # At least 30s or 1s per 30px - logger.debug(f"Adjusted duration for large content: {self.dynamic_duration}s") + if self.dynamic_duration < 45 and self.total_scroll_width > 200: + # If we have content but short duration, increase it + # Use a more generous calculation: at least 45s or 1s per 20px + 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"Leaderboard dynamic duration calculation:") logger.debug(f" Display width: {display_width}px") diff --git a/src/odds_ticker_manager.py b/src/odds_ticker_manager.py index 2d4c00ab..e153b88a 100644 --- a/src/odds_ticker_manager.py +++ b/src/odds_ticker_manager.py @@ -1380,13 +1380,13 @@ class OddsTickerManager: # and add extra time to ensure we don't cut off mid-scroll if self.loop: # Add extra buffer for looping to ensure smooth transition - # Use a more reasonable buffer to prevent excessive looping - loop_buffer = total_time * 0.15 # 15% extra for looping (reduced from 30%) + # Use a more generous buffer to ensure complete content display + loop_buffer = total_time * 0.2 # 20% extra for looping (increased from 15%) calculated_duration = int(total_time + buffer_time + loop_buffer) logger.debug(f"Looping enabled, added {loop_buffer:.2f}s loop buffer") else: # Even without looping, add extra buffer to ensure complete display - extra_buffer = total_time * 0.1 # 10% extra to ensure complete content display (reduced from 15%) + extra_buffer = total_time * 0.15 # 15% extra to ensure complete content display (increased from 10%) calculated_duration = int(total_time + buffer_time + extra_buffer) logger.debug(f"No looping, added {extra_buffer:.2f}s extra buffer for complete display") @@ -1402,10 +1402,11 @@ class OddsTickerManager: # Additional safety check: if the calculated duration seems too short for the content, # ensure we have enough time to display all content properly - if self.dynamic_duration < 30 and self.total_scroll_width > 800: - # If we have a lot of content but short duration, increase it - self.dynamic_duration = max(30, int(self.total_scroll_width / 30)) # At least 30s or 1s per 30px - logger.debug(f"Adjusted duration for large content: {self.dynamic_duration}s") + if self.dynamic_duration < 45 and self.total_scroll_width > 200: + # If we have content but short duration, increase it + # Use a more generous calculation: at least 45s or 1s per 20px + 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"Odds ticker dynamic duration calculation:") logger.debug(f" Display width: {display_width}px")