Commit Graph

30 Commits

Author SHA1 Message Date
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
Chuck
764d80e818 added more missing soccer logos 2025-09-16 14:31:31 -04:00
Chuck
fcbc67464d persistent config file via config.template.json and migrate_config.sh 2025-09-15 10:27:16 -04:00
Chuck
b8aaa56b4b Add NCAA football logo download script and update team abbreviations
- Added download_espn_ncaa_fb_logos.py script to download logos from ESPN API
- Downloaded 50 NCAA football team logos to test/ncaaFBlogos/
- Updated all_team_abbreviations.txt with current ESPN team data
- Updated various team logo files (MLB, NBA, NFL, NHL, NCAAF)
2025-09-12 18:01:43 -04:00
Chuck
335ab8cce0 update leaderboard data sources for other sports and font sizes 2025-09-12 13:35:01 -04:00
Chuck
153edcc2e1 update record & rank logic, update leaderboard font and logo sizes 2025-09-12 12:08:46 -04:00
Chuck
548bc00e00 use correct AP Poll top 25 for NCAAFB 2025-09-12 11:50:51 -04:00
Chuck
3329822a46 update tnt logo 2025-09-10 18:21:03 -04:00
Chuck
3ee7821353 update some broadcast logos and fix multiple stacked panels logic 2025-09-10 18:13:42 -04:00
Chuck
457f9f9eb5 better error handling and correct image call for top 25 2025-09-10 16:45:34 -04:00
ChuckBuilds
8a0fdb005d update UTC timezone logic to check config settings for all managers 2025-09-04 22:18:01 -04:00
ChuckBuilds
e4b3adb867 Fix test script to handle missing game data keys
- Added safe key access using .get() method with defaults
- Added display of available keys in game data for debugging
- Added sport field display to help identify data structure
- This prevents KeyError when game data structure changes
2025-08-18 19:09:50 -05:00
ChuckBuilds
9f00124fad Fix odds ticker dynamic duration calculation
- Fixed double-counting of display width in total_scroll_width calculation
- Added detailed debug logging for dynamic duration calculation
- Added debug logging for scrolling behavior and loop resets
- Created test script for debugging dynamic duration issues
- The issue was that total_scroll_width included display width, causing
  incorrect duration calculations that resulted in early cutoff
2025-08-18 19:05:36 -05:00
ChuckBuilds
68416d0293 live games in odds ticker 2025-08-18 15:50:23 -05:00
ChuckBuilds
54635fee3c ensure game rotation count respects user defined variable 2025-08-14 13:01:23 -05:00
Chuck
ede82406fa set web ui v2 to be default 2025-08-10 17:18:59 -05:00
Chuck
85d63243c7 AI bug squash sesh 2025-08-09 21:00:25 -05:00
Chuck
afb7e23fcc fix soccer timezone 2025-08-09 16:03:02 -05:00
Chuck
1ffe3e7c16 add favorite team filtering to soccer manager and ensure timezones are respected 2025-08-09 15:54:15 -05:00
Chuck
4088807c72 milb_manager cache test 2025-08-09 10:22:56 -05:00
Chuck
3c665c21d1 milb turn off test mode.... 2025-08-02 17:31:35 -05:00
Chuck
f95138d1a4 milb diagnosis script with error fixes 2025-08-01 17:56:53 -05:00
Chuck
04009f78f7 milb diagnosis 2025-08-01 17:52:06 -05:00
Chuck
9280538e08 adjust user configurable parts of stock ticker 2025-07-23 17:02:50 -05:00
Chuck
b5b18babe8 revert daily weather temp font change due to negative effects on other displays 2025-07-23 14:27:50 -05:00
Chuck
723b7ce190 fix bdf font for weather 2025-07-23 14:17:53 -05:00
Chuck
b6244075a7 change font test size 2025-07-22 21:46:33 -05:00
Chuck
7c45179248 update parent directory of font test 2025-07-22 21:40:45 -05:00
Chuck
cb81bec042 add Of The Day display 2025-07-22 20:39:09 -05:00
Chuck
3ab28e8201 move test files to test folder to clean up repo 2025-07-22 20:01:39 -05:00