Files
LEDMatrix/config/config.template.json
Chuck 9dc1118d79 Feature/background season data (#46)
* Fix NCAAFB ranking display issue

- Remove duplicate ranking system that was drawing rankings behind team logos
- Old system (_get_rank) was drawing rankings at top of logos
- New system (_fetch_team_rankings) correctly draws rankings in bottom corners
- Remove old ranking calls from live, recent, and upcoming game drawing functions
- Remove unnecessary _fetch_rankings() calls from update methods
- Rankings now only appear in designated corner positions, not overlapping logos

Fixes issue where team rankings/betting lines were being drawn behind
team logos instead of replacing team records in the corners.

* Add missing show_ranking and show_records options to NCAAFB web UI

- Add show_ranking option to NCAAFB scoreboard config template
- Add show_records and show_ranking toggle switches to NCAAFB web UI
- Update JavaScript form collection to include new fields
- Users can now control whether to show team records or rankings via web interface

This completes the fix for NCAAFB ranking display - users can now enable
show_ranking in the web UI to see AP Top 25 rankings instead of team records.

* Implement Background Threading for Season Data Fetching

Phase 1: Background Season Data Fetching - COMPLETED

Key Features:
- Created BackgroundDataService class with thread-safe operations
- Implemented automatic retry logic with exponential backoff
- Modified NFL manager to use background service
- Added immediate partial data return for non-blocking display
- Comprehensive logging and statistics tracking

Performance Benefits:
- Main display loop no longer blocked by API calls
- Season data always fresh with background updates
- Better user experience during data fetching

Files Added/Modified:
- src/background_data_service.py (NEW)
- src/nfl_managers.py (updated)
- config/config.template.json (updated)
- test_background_service.py (NEW)
- BACKGROUND_SERVICE_README.md (NEW)

* Fix data validation issues in background service

- Add comprehensive data structure validation in NFL managers
- Handle malformed events gracefully with proper error logging
- Validate cached data format and handle legacy formats
- Add data validation in background service response parsing
- Fix TypeError: string indices must be integers, not 'str'

This fixes the error where events were being treated as strings
instead of dictionaries, causing crashes in recent/upcoming games.

* Phase 2: Apply Background Service to Major Sport Managers

 Applied background service support to:
- NCAAFB Manager (College Football)
- NBA Manager (Basketball)
- NHL Manager (Hockey)
- MLB Manager (Baseball)

🔧 Key Features Added:
- Background service initialization for each sport
- Configurable workers, timeouts, and retry settings
- Graceful fallback when background service is disabled
- Comprehensive logging for monitoring

⚙️ Configuration Updates:
- Added background_service config section to NBA
- Added background_service config section to NHL
- Added background_service config section to NCAAFB
- Each sport can independently enable/disable background service

📈 Performance Benefits:
- Season data fetching no longer blocks display loops
- Immediate response with cached/partial data
- Background threads handle heavy API calls
- Better responsiveness across all supported sports

Next: Apply to remaining managers (MiLB, Soccer, etc.)

* Fix Python compatibility issue in BackgroundDataService shutdown

🐛 Bug Fix:
- Fixed TypeError in ThreadPoolExecutor.shutdown() for older Python versions
- Added try/catch to handle timeout parameter compatibility
- Fallback gracefully for Python < 3.9 that doesn't support timeout parameter

🔧 Technical Details:
- ThreadPoolExecutor.shutdown(timeout=) was added in Python 3.9
- Older versions only support shutdown(wait=)
- Added compatibility layer with proper error handling

 Result:
- No more shutdown exceptions on older Python versions
- Graceful degradation for different Python environments
- Maintains full functionality on newer Python versions

* Phase 2 Complete: Background Service Applied to All Sport Managers

🎉 MAJOR MILESTONE: Complete Background Service Rollout

 All Sport Managers Now Support Background Service:
- MiLB Manager (Minor League Baseball)
- Soccer Manager (Multiple leagues: Premier League, La Liga, etc.)
- Leaderboard Manager (Multi-sport standings)
- Odds Ticker Manager (Live betting odds)

🔧 Technical Implementation:
- Background service initialization in all managers
- Configurable workers, timeouts, and retry settings
- Graceful fallback when background service is disabled
- Comprehensive logging for monitoring and debugging
- Thread-safe operations with proper error handling

⚙️ Configuration Support Added:
- MiLB: background_service config section
- Soccer: background_service config section
- Leaderboard: background_service config section
- Odds Ticker: background_service config section
- Each manager can independently enable/disable background service

📈 Performance Benefits Achieved:
- Non-blocking data fetching across ALL sport managers
- Immediate response with cached/partial data
- Background threads handle heavy API calls
- Significantly improved responsiveness
- Better user experience during data loading

🚀 Production Ready:
- All major sport managers now support background threading
- Comprehensive configuration options
- Robust error handling and fallback mechanisms
- Ready for production deployment

Next: Phase 3 - Advanced features (priority queuing, analytics)

* Update wiki submodule with Background Service documentation

📚 Wiki Documentation Added:
- Complete Background Service Guide with architecture diagrams
- Configuration examples and best practices
- Performance benefits and troubleshooting guide
- Migration guide and advanced features

🔧 Navigation Updates:
- Added to sidebar under Technical section
- Updated home page with performance section
- Highlighted as NEW feature with  icon

The wiki now includes comprehensive documentation for the new
background threading system that improves performance across
all sport managers.

* Fix CacheManager constructor in test script

🐛 Bug Fix:
- Fixed CacheManager initialization in test_background_service.py
- CacheManager no longer takes config_manager parameter
- Updated constructor call to match current implementation

 Result:
- Test script now works with current CacheManager API
- Background service testing can proceed without errors

* Move test_background_service.py to test/ directory

📁 Organization Improvement:
- Moved test_background_service.py from root to test/ directory
- Updated import paths to work from new location
- Fixed sys.path to correctly reference src/ directory
- Updated imports to use relative paths

🔧 Technical Changes:
- Changed sys.path from 'src' to '../src' (go up from test/)
- Updated imports to remove 'src.' prefix
- Maintains all functionality while improving project structure

 Benefits:
- Better project organization
- Test files properly grouped in test/ directory
- Cleaner root directory structure
- Follows standard Python project layout

* Remove old test_background_service.py from root directory

📁 Cleanup:
- Removed test_background_service.py from root directory
- File has been moved to test/ directory for better organization
- Maintains clean project structure

* Fix NCAA FB team ranking display functionality

- Add missing _fetch_team_rankings() calls to all update methods (live, recent, upcoming)
- Add ranking display logic to live manager scorebug layout
- Remove unused old _fetch_rankings() method and top_25_rankings variable
- Rankings now properly display as #X format when show_ranking is enabled
- Fixes non-functional ranking feature despite existing UI and configuration options
2025-09-17 17:25:01 -04:00

609 lines
17 KiB
JSON

{
"web_display_autostart": true,
"schedule": {
"enabled": true,
"start_time": "07:00",
"end_time": "23:00"
},
"timezone": "America/Chicago",
"location": {
"city": "Dallas",
"state": "Texas",
"country": "US"
},
"display": {
"hardware": {
"rows": 32,
"cols": 64,
"chain_length": 2,
"parallel": 1,
"brightness": 95,
"hardware_mapping": "adafruit-hat-pwm",
"scan_mode": 0,
"pwm_bits": 9,
"pwm_dither_bits": 1,
"pwm_lsb_nanoseconds": 130,
"disable_hardware_pulsing": false,
"inverse_colors": false,
"show_refresh_rate": false,
"limit_refresh_rate_hz": 120
},
"runtime": {
"gpio_slowdown": 3
},
"display_durations": {
"clock": 15,
"weather": 30,
"stocks": 30,
"hourly_forecast": 30,
"daily_forecast": 30,
"stock_news": 20,
"odds_ticker": 60,
"leaderboard": 60,
"nhl_live": 30,
"nhl_recent": 30,
"nhl_upcoming": 30,
"nba_live": 30,
"nba_recent": 30,
"nba_upcoming": 30,
"nfl_live": 30,
"nfl_recent": 30,
"nfl_upcoming": 30,
"ncaa_fb_live": 30,
"ncaa_fb_recent": 30,
"ncaa_fb_upcoming": 30,
"ncaa_baseball_live": 30,
"ncaa_baseball_recent": 30,
"ncaa_baseball_upcoming": 30,
"calendar": 30,
"youtube": 30,
"mlb_live": 30,
"mlb_recent": 30,
"mlb_upcoming": 30,
"milb_live": 30,
"milb_recent": 30,
"milb_upcoming": 30,
"text_display": 10,
"soccer_live": 30,
"soccer_recent": 30,
"soccer_upcoming": 30,
"ncaam_basketball_live": 30,
"ncaam_basketball_recent": 30,
"ncaam_basketball_upcoming": 30,
"music": 30,
"of_the_day": 40,
"news_manager": 60
},
"use_short_date_format": true
},
"clock": {
"enabled": true,
"format": "%I:%M %p",
"update_interval": 1
},
"weather": {
"enabled": false,
"update_interval": 1800,
"units": "imperial",
"display_format": "{temp}°F\n{condition}"
},
"stocks": {
"enabled": false,
"update_interval": 600,
"scroll_speed": 1,
"scroll_delay": 0.01,
"toggle_chart": true,
"dynamic_duration": true,
"min_duration": 30,
"max_duration": 300,
"duration_buffer": 0.1,
"symbols": [
"ASTS",
"SCHD",
"INTC",
"NVDA",
"T",
"VOO",
"SMCI"
],
"display_format": "{symbol}: ${price} ({change}%)"
},
"crypto": {
"enabled": false,
"update_interval": 600,
"symbols": [
"BTC-USD",
"ETH-USD"
],
"display_format": "{symbol}: ${price} ({change}%)"
},
"stock_news": {
"enabled": false,
"update_interval": 3600,
"scroll_speed": 1,
"scroll_delay": 0.01,
"max_headlines_per_symbol": 1,
"headlines_per_rotation": 2,
"dynamic_duration": true,
"min_duration": 30,
"max_duration": 300,
"duration_buffer": 0.1
},
"odds_ticker": {
"enabled": true,
"show_favorite_teams_only": true,
"games_per_favorite_team": 1,
"max_games_per_league": 5,
"show_odds_only": false,
"sort_order": "soonest",
"enabled_leagues": [
"nfl",
"mlb",
"ncaa_fb",
"milb"
],
"update_interval": 3600,
"scroll_speed": 1,
"scroll_delay": 0.01,
"loop": true,
"future_fetch_days": 50,
"show_channel_logos": true,
"dynamic_duration": true,
"min_duration": 30,
"max_duration": 300,
"duration_buffer": 0.1,
"background_service": {
"enabled": true,
"max_workers": 3,
"request_timeout": 30,
"max_retries": 3,
"priority": 2
}
},
"leaderboard": {
"enabled": false,
"enabled_sports": {
"nfl": {
"enabled": true,
"top_teams": 10
},
"nba": {
"enabled": false,
"top_teams": 10
},
"mlb": {
"enabled": false,
"top_teams": 10
},
"ncaa_fb": {
"enabled": true,
"top_teams": 25,
"show_ranking": true
},
"nhl": {
"enabled": false,
"top_teams": 10
},
"ncaam_basketball": {
"enabled": false,
"top_teams": 25
},
"ncaam_hockey": {
"enabled": true,
"top_teams": 10,
"show_ranking": true
}
},
"update_interval": 3600,
"scroll_speed": 1,
"scroll_delay": 0.01,
"display_duration": 60,
"loop": false,
"request_timeout": 30,
"dynamic_duration": true,
"min_duration": 45,
"max_duration": 600,
"duration_buffer": 0.1,
"background_service": {
"enabled": true,
"max_workers": 3,
"request_timeout": 30,
"max_retries": 3,
"priority": 2
}
},
"calendar": {
"enabled": false,
"credentials_file": "credentials.json",
"token_file": "token.pickle",
"update_interval": 3600,
"max_events": 3,
"calendars": [
"birthdays"
]
},
"nhl_scoreboard": {
"enabled": false,
"live_priority": true,
"live_game_duration": 20,
"show_odds": true,
"test_mode": false,
"update_interval_seconds": 3600,
"live_update_interval": 30,
"recent_update_interval": 3600,
"upcoming_update_interval": 3600,
"recent_games_to_show": 1,
"upcoming_games_to_show": 1,
"show_favorite_teams_only": true,
"favorite_teams": [
"TB"
],
"logo_dir": "assets/sports/nhl_logos",
"show_records": true,
"background_service": {
"enabled": true,
"max_workers": 3,
"request_timeout": 30,
"max_retries": 3,
"priority": 2
},
"display_modes": {
"nhl_live": true,
"nhl_recent": true,
"nhl_upcoming": true
}
},
"nba_scoreboard": {
"enabled": false,
"live_priority": true,
"live_game_duration": 20,
"show_odds": true,
"test_mode": false,
"update_interval_seconds": 3600,
"live_update_interval": 30,
"live_odds_update_interval": 3600,
"odds_update_interval": 3600,
"recent_update_interval": 3600,
"upcoming_update_interval": 3600,
"recent_games_to_show": 1,
"upcoming_games_to_show": 1,
"show_favorite_teams_only": true,
"favorite_teams": [
"DAL"
],
"logo_dir": "assets/sports/nba_logos",
"show_records": true,
"background_service": {
"enabled": true,
"max_workers": 3,
"request_timeout": 30,
"max_retries": 3,
"priority": 2
},
"display_modes": {
"nba_live": true,
"nba_recent": true,
"nba_upcoming": true
}
},
"nfl_scoreboard": {
"enabled": false,
"live_priority": true,
"live_game_duration": 30,
"show_odds": true,
"test_mode": false,
"update_interval_seconds": 3600,
"live_update_interval": 30,
"live_odds_update_interval": 3600,
"odds_update_interval": 3600,
"recent_update_interval": 3600,
"upcoming_update_interval": 3600,
"recent_games_to_show": 1,
"upcoming_games_to_show": 1,
"show_favorite_teams_only": true,
"favorite_teams": [
"TB",
"DAL"
],
"logo_dir": "assets/sports/nfl_logos",
"show_records": true,
"background_service": {
"enabled": true,
"max_workers": 3,
"request_timeout": 30,
"max_retries": 3,
"priority": 2
},
"display_modes": {
"nfl_live": true,
"nfl_recent": true,
"nfl_upcoming": true
}
},
"ncaa_fb_scoreboard": {
"enabled": false,
"live_priority": true,
"live_game_duration": 20,
"show_odds": true,
"test_mode": false,
"update_interval_seconds": 3600,
"live_update_interval": 30,
"live_odds_update_interval": 3600,
"odds_update_interval": 3600,
"season_cache_duration_seconds": 86400,
"recent_games_to_show": 1,
"upcoming_games_to_show": 1,
"show_favorite_teams_only": true,
"favorite_teams": [
"UGA",
"AUB"
],
"logo_dir": "assets/sports/ncaa_logos",
"show_records": true,
"show_ranking": true,
"background_service": {
"enabled": true,
"max_workers": 3,
"request_timeout": 30,
"max_retries": 3,
"priority": 2
},
"display_modes": {
"ncaa_fb_live": true,
"ncaa_fb_recent": true,
"ncaa_fb_upcoming": true
}
},
"ncaa_baseball_scoreboard": {
"enabled": false,
"live_priority": true,
"live_game_duration": 30,
"show_odds": true,
"test_mode": false,
"update_interval_seconds": 3600,
"live_update_interval": 30,
"recent_update_interval": 3600,
"upcoming_update_interval": 3600,
"recent_games_to_show": 1,
"upcoming_games_to_show": 1,
"show_favorite_teams_only": true,
"favorite_teams": [
"UGA",
"AUB"
],
"logo_dir": "assets/sports/ncaa_logos",
"show_records": true,
"display_modes": {
"ncaa_baseball_live": true,
"ncaa_baseball_recent": true,
"ncaa_baseball_upcoming": true
}
},
"ncaam_basketball_scoreboard": {
"enabled": false,
"live_priority": true,
"live_game_duration": 20,
"show_odds": true,
"test_mode": false,
"update_interval_seconds": 3600,
"live_update_interval": 30,
"recent_games_to_show": 1,
"upcoming_games_to_show": 1,
"show_favorite_teams_only": true,
"favorite_teams": [
"UGA",
"AUB"
],
"logo_dir": "assets/sports/ncaa_logos",
"show_records": true,
"display_modes": {
"ncaam_basketball_live": true,
"ncaam_basketball_recent": true,
"ncaam_basketball_upcoming": true
}
},
"ncaam_hockey_scoreboard": {
"enabled": true,
"live_priority": true,
"live_game_duration": 20,
"show_odds": true,
"test_mode": false,
"update_interval_seconds": 3600,
"live_update_interval": 30,
"live_odds_update_interval": 3600,
"odds_update_interval": 3600,
"season_cache_duration_seconds": 86400,
"recent_games_to_show": 1,
"upcoming_games_to_show": 1,
"show_favorite_teams_only": true,
"favorite_teams": [
"RIT"
],
"logo_dir": "assets/sports/ncaa_logos",
"show_records": true,
"show_ranking": true,
"display_modes": {
"ncaam_hockey_live": true,
"ncaam_hockey_recent": true ,
"ncaam_hockey_upcoming": true
}
},
"youtube": {
"enabled": false,
"update_interval": 3600
},
"mlb": {
"enabled": false,
"live_priority": false,
"live_game_duration": 30,
"show_odds": true,
"test_mode": false,
"update_interval_seconds": 3600,
"live_update_interval": 30,
"live_odds_update_interval": 3600,
"odds_update_interval": 3600,
"recent_update_interval": 3600,
"upcoming_update_interval": 3600,
"recent_games_to_show": 1,
"upcoming_games_to_show": 1,
"show_favorite_teams_only": true,
"favorite_teams": [
"TB",
"TEX"
],
"logo_dir": "assets/sports/mlb_logos",
"show_records": true,
"display_modes": {
"mlb_live": true,
"mlb_recent": true,
"mlb_upcoming": true
}
},
"milb": {
"enabled": false,
"live_priority": false,
"live_game_duration": 30,
"test_mode": false,
"update_interval_seconds": 3600,
"live_update_interval": 30,
"recent_update_interval": 3600,
"upcoming_update_interval": 3600,
"recent_games_to_show": 1,
"upcoming_games_to_show": 1,
"favorite_teams": [
"TAM"
],
"logo_dir": "assets/sports/milb_logos",
"show_records": true,
"upcoming_fetch_days": 7,
"background_service": {
"enabled": true,
"max_workers": 3,
"request_timeout": 30,
"max_retries": 3,
"priority": 2
},
"display_modes": {
"milb_live": true,
"milb_recent": true,
"milb_upcoming": true
}
},
"text_display": {
"enabled": false,
"text": "Subscribe to ChuckBuilds",
"font_path": "assets/fonts/press-start-2p.ttf",
"font_size": 8,
"scroll": true,
"scroll_speed": 40,
"text_color": [
255,
0,
0
],
"background_color": [
0,
0,
0
],
"scroll_gap_width": 32
},
"soccer_scoreboard": {
"enabled": false,
"live_priority": true,
"live_game_duration": 30,
"show_odds": true,
"test_mode": false,
"update_interval_seconds": 3600,
"live_update_interval": 30,
"recent_update_interval": 3600,
"upcoming_update_interval": 3600,
"recent_games_to_show": 1,
"upcoming_games_to_show": 1,
"show_favorite_teams_only": true,
"favorite_teams": [
"DAL"
],
"leagues": [
"usa.1"
],
"logo_dir": "assets/sports/soccer_logos",
"show_records": true,
"background_service": {
"enabled": true,
"max_workers": 3,
"request_timeout": 30,
"max_retries": 3,
"priority": 2
},
"display_modes": {
"soccer_live": true,
"soccer_recent": true,
"soccer_upcoming": true
}
},
"music": {
"enabled": false,
"preferred_source": "ytm",
"YTM_COMPANION_URL": "http://192.168.86.12:9863",
"POLLING_INTERVAL_SECONDS": 1
},
"of_the_day": {
"enabled": false,
"display_rotate_interval": 20,
"update_interval": 3600,
"subtitle_rotate_interval": 10,
"category_order": [
"word_of_the_day",
"slovenian_word_of_the_day"
],
"categories": {
"word_of_the_day": {
"enabled": true,
"data_file": "of_the_day/word_of_the_day.json",
"display_name": "Word of the Day"
},
"slovenian_word_of_the_day": {
"enabled": true,
"data_file": "of_the_day/slovenian_word_of_the_day.json",
"display_name": "Slovenian Word of the Day"
}
}
},
"news_manager": {
"enabled": false,
"update_interval": 300,
"scroll_speed": 1,
"scroll_delay": 0.01,
"headlines_per_feed": 2,
"enabled_feeds": [
"NFL",
"NCAA FB",
"F1",
"BBC F1"
],
"custom_feeds": {
"F1": "https://www.espn.com/espn/rss/rpm/news",
"BBC F1": "http://feeds.bbci.co.uk/sport/formula1/rss.xml"
},
"rotation_enabled": true,
"rotation_threshold": 3,
"dynamic_duration": true,
"min_duration": 30,
"max_duration": 300,
"duration_buffer": 0.1,
"font_size": 8,
"font_path": "assets/fonts/PressStart2P-Regular.ttf",
"text_color": [
255,
255,
255
],
"separator_color": [
255,
0,
0
]
}
}