mirror of
https://github.com/ChuckBuilds/LEDMatrix.git
synced 2026-04-10 13:02:59 +00:00
dynamic duration for odds ticker has larger buffer
This commit is contained in:
@@ -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")
|
||||
|
||||
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user