Fix/odds ticker manager log spam (#65)

* fix(odds-ticker): Reduce log spam from insufficient time warnings

- Add _insufficient_time_warning_logged flag to prevent repeated warnings
- Log insufficient time warning only once per display session
- Reset warning flag when starting new display or updating data
- Maintain debug logging for scroll position resets to aid debugging

This addresses the frequent 'Not enough time to complete content display'
warnings that were flooding the logs every few milliseconds.

* fix(leaderboard): Reduce log spam from progress and FPS logging

- Change progress logging from every 50 pixels to every 5 seconds
- Increase FPS logging interval from 10 seconds to 30 seconds
- Add progress_log_interval and last_progress_log_time variables
- Reset progress log timer when starting new display sessions or updating data
- Maintain debug capability while significantly reducing log volume

This addresses the frequent 'Leaderboard progress' and 'Leaderboard FPS'
messages that were flooding the logs during leaderboard scrolling.

* fix(music): Reduce log spam from track update logging

- Add throttling mechanism for track update logging
- Log track updates only when track title changes or after 5 seconds
- Track last_logged_track_title and last_track_log_time to prevent spam
- Maintain debug logging for throttled updates
- Apply throttling to both regular updates and first valid data logging

This addresses the frequent 'Track info updated' messages that were
flooding the logs every few hundred milliseconds for the same track.

* fix(logo-downloader): Fix TA&M filename normalization issue

- Add special case for TA&M to keep as TA&M instead of converting to TAANDM
- This fixes the issue where code was looking for TAANDM.png instead of TA&M.png
- The actual logo file exists as TA&M.png, so normalization was causing file not found errors
- Prevents unnecessary download attempts and permission errors for existing files

Fixes the error: 'Logo not found for TA&M at assets/sports/ncaa_logos/TAANDM.png'

* fix(logo-downloader): Implement robust filename variation handling

- Add get_logo_filename_variations() method to handle multiple filename formats
- Update _load_and_resize_logo() to try filename variations before downloading
- Handles cases like TA&M.png vs TAANDM.png gracefully
- Maintains backward compatibility with existing normalized filenames
- Prevents issues with special characters in filenames while supporting existing files

This addresses the ampersand filename issue more robustly by:
1. First trying the original filename (TA&M.png)
2. Falling back to normalized filename (TAANDM.png) if needed
3. Only attempting downloads if no variations exist

* fix(leaderboard): Reduce log spam from end reached messages

- Add _end_reached_logged flag to prevent repeated end reached warnings
- Log 'Leaderboard reached end' and 'scrolling stopped' messages only once per display session
- Maintain debug logging for throttled messages to aid debugging
- Reset flag when starting new display sessions or updating data
- Apply same throttling pattern used in odds ticker manager

This addresses the frequent 'Leaderboard reached end' and 'scrolling stopped'
messages that were flooding the logs every few milliseconds when at the end.
This commit is contained in:
Chuck
2025-09-25 10:28:55 -04:00
committed by GitHub
parent ad8a652183
commit 5bfcdaf4ff
5 changed files with 114 additions and 14 deletions

View File

@@ -101,6 +101,7 @@ class LogoDownloader:
"""Normalize team abbreviation for consistent filename usage."""
# Handle special characters that can cause filesystem issues
normalized = abbreviation.upper()
# Replace problematic characters with safe alternatives
normalized = normalized.replace('&', 'AND')
normalized = normalized.replace('/', '_')
@@ -114,6 +115,23 @@ class LogoDownloader:
normalized = normalized.replace('|', '_')
return normalized
@staticmethod
def get_logo_filename_variations(abbreviation: str) -> list:
"""Get possible filename variations for a team abbreviation."""
variations = []
original = abbreviation.upper()
normalized = LogoDownloader.normalize_abbreviation(abbreviation)
# Add original and normalized versions
variations.extend([f"{original}.png", f"{normalized}.png"])
# Special handling for known cases
if original == 'TA&M':
# TA&M has a file named TA&M.png, but normalize creates TAANDM.png
variations = [f"{original}.png", f"{normalized}.png"]
return variations
def get_logo_directory(self, league: str) -> str:
"""Get the logo directory for a given league."""
return self.LOGO_DIRECTORIES.get(league, f'assets/sports/{league}_logos')