Commit Graph

41 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
854c236a60 added portuguese soccer league to documentation for soccer manager and added auto-download missing logos for soccer teams 2025-09-16 14:25:47 -04:00
Chuck
9200c9cab3 update logic on all sports displays that upcoming and recent games to show are based on each team, not just the first X # of games found 2025-09-15 18:28:40 -04:00
Chuck
bc3883df14 config manager reductions to reduce overhead 2025-09-12 17:15:45 -04:00
Chuck
3ee7821353 update some broadcast logos and fix multiple stacked panels logic 2025-09-10 18:13:42 -04:00
ChuckBuilds
a3dbc6a4a8 standardize config init across displays 2025-09-04 22:24:02 -04:00
ChuckBuilds
2b93eafcdf improve odds ticker dynamic duration 2025-08-18 19:23:20 -05:00
ChuckBuilds
6152969340 fix favorite team toggle logic being skipped 2025-08-14 12:26:57 -05:00
Chuck
d179700c6c Removed the problematic os.path.dirname(os.path.abspath(__file__)) pattern 2025-08-13 21:35:53 -05:00
Chuck
6bc1039ed6 change how font is loaded via systemctl - added direct paths 2025-08-13 20:36:23 -05:00
Chuck
ca44097669 update ncaa FB and NFL recent games to look more like other displays 2025-08-10 11:05:03 -05:00
Chuck
79cbc46f9b set soccer logging to info 2025-08-09 20:45:56 -05:00
Chuck
29f36827ca adjust score spacing soccer 2025-08-09 20:21:35 -05:00
Chuck
938c31c815 adjust MLS half detection 2025-08-09 20:03:44 -05:00
Chuck
8654dd44e6 all sports managers process recent and upcoming games as a function of game count instead of time (hours). Ensure all sports managers respect favorite team filtering if enabled 2025-08-09 16:47:38 -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
5ec9b3ea6f case insensitive soccer logos 2025-08-09 14:17:05 -05:00
Chuck
708e993f41 soccer game extraction improvement 2025-08-09 14:09:05 -05:00
Chuck
b4d5aef876 milb logging and manual cache clearing 2025-08-09 10:44:58 -05:00
Chuck
a672abba6a soccer logger update 2025-08-09 10:35:56 -05:00
Chuck
c490c5dca8 ensure displays share config file 2025-08-02 19:33:24 -05:00
Chuck
7fc902dea1 cache updates for live games in all sports 2025-07-24 08:21:14 -05:00
Chuck
18b0a9703e remove all sports live displays from checking cache 2025-07-23 20:31:25 -05:00
Chuck
df3d010c65 toggleable short date format 2025-07-22 11:28:13 -05:00
Chuck
a580d87876 massive refactor on game filtering logic and odds calls for all sports displays 2025-07-22 11:06:54 -05:00
Chuck
8dccebff01 centered team logos in odds ticker and removed dynamic display duration 2025-07-21 16:42:24 -05:00
Chuck
06fa6d656a adjustments to formatting of odds 2025-07-21 15:43:22 -05:00
Chuck
94f0eb060b lots of visual and logic changes 2025-07-21 15:22:12 -05:00
Chuck
1dcd79f758 add granular control over records display and troubleshooting odds ticker. Enabled Team Records for all sports 2025-07-20 20:52:55 -05:00
Chuck
aa379e8369 gambling updates 2025-07-18 22:12:33 -05:00
Chuck
1922d5e3b0 fixed clock / timezone configuration discrepancies 2025-07-17 11:12:45 -05:00
ChuckBuilds
745aebab3b feat(soccer): Optimize API calls using team-league map 2025-05-03 21:07:01 -05:00
ChuckBuilds
d65d544c31 refactor(soccer): Align upcoming game display with NHL layout 2025-05-01 10:21:30 -05:00
ChuckBuilds
5931ac5ec0 Style: Stack date and time for upcoming soccer games 2025-05-01 10:02:33 -05:00
ChuckBuilds
3102d45e3c Feat: Make soccer upcoming fetch window configurable 2025-05-01 09:53:33 -05:00
ChuckBuilds
e2ac40fe72 Refactor: Optimize soccer data fetching and caching 2025-05-01 09:45:43 -05:00
ChuckBuilds
1536fb9de9 fix: Use league-specific URLs for fetching soccer data 2025-04-30 14:56:59 -05:00
ChuckBuilds
d43894780d fix: Correct date format typo in soccer data fetching 2025-04-30 14:40:42 -05:00
ChuckBuilds
a6548c3442 refactor: Update soccer scorebug layout 2025-04-30 14:39:44 -05:00
ChuckBuilds
890770bf2a feat: Add soccer scoreboard display 2025-04-30 13:34:59 -05:00