Commit Graph

69 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
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
ChuckBuilds
f13e9306c9 more fallback errors for milb fonts 2025-08-14 16:46:48 -05:00
ChuckBuilds
ef82610a06 milb font error handling 2025-08-14 13:39:48 -05:00
ChuckBuilds
54635fee3c ensure game rotation count respects user defined variable 2025-08-14 13:01:23 -05:00
Chuck
6bc1039ed6 change how font is loaded via systemctl - added direct paths 2025-08-13 20:36:23 -05:00
Chuck
4b906b3a92 remove autostart of dsiplay from autostart of web ui 2025-08-13 14:59:49 -05:00
Chuck
9d4082665a graceful font fallback 2025-08-13 12:53:11 -05:00
Chuck
b8d9eb65f6 clean up milb upcoming 2025-08-11 18:00:40 -05:00
Chuck
03f0a6e6e2 troubleshoot milb upcoming 2025-08-11 17:25:03 -05:00
Chuck
865b30c631 reduce log spam 2025-08-11 15:45:19 -05:00
Chuck
809cb07bb8 on demand displays 2025-08-10 20:46:41 -05:00
Chuck
edce5fae85 milb upcoming game debug logging 2025-08-10 18:26:25 -05:00
Chuck
10c1342bdb milb upcoming game debug logging 2025-08-10 17:38:56 -05:00
Chuck
e5eef1320d milb live game check extended to 5 minutes 2025-08-09 14:20:08 -05:00
Chuck
7b31c4cca5 milb deduplication 2025-08-09 13:55:34 -05:00
Chuck
be94e9fb6b decision flag debug logging for when games are rejected MILB 2025-08-09 13:48:52 -05:00
Chuck
1b9981d74e try to handle incorrect api data from milb 2025-08-09 13:42:04 -05:00
Chuck
f1ad263849 got duplicate live feeds for milb 2025-08-09 13:38:23 -05:00
Chuck
d802adb048 updates to milb live descriptors 2025-08-09 13:32:22 -05:00
Chuck
71bb616b76 changes to fildering and processing of MILB live games 2025-08-09 13:26:18 -05:00
Chuck
3ba0ec2041 milb live logic change 2025-08-09 13:17:10 -05:00
Chuck
40576ac18d shorten live check for milbLive Manager 2025-08-09 13:09:48 -05:00
Chuck
e6fa83904b pull live games even if missing inning info 2025-08-09 13:05:49 -05:00
Chuck
a52696aae2 milb update interval 2025-08-09 12:46:12 -05:00
Chuck
e9ca9a0454 milb upcoming type error 2025-08-09 12:22:34 -05:00
Chuck
7d38bbb0fa display update improvements and less logging 2025-08-09 12:03:56 -05:00
Chuck
512ffb7639 live games respect update durations from config 2025-08-09 12:00:12 -05:00
Chuck
cc652472a0 improved game filtering milb 2025-08-09 11:47:20 -05:00
Chuck
436bdbd8f2 milb debugging around strikes an dballs. 2025-08-09 11:10:19 -05:00
Chuck
96de2e7d0f milb debugging 2025-08-09 11:04:39 -05:00
Chuck
b4d5aef876 milb logging and manual cache clearing 2025-08-09 10:44:58 -05:00
Chuck
b193e03be9 milb_manager live display logic update and enable mls 2025-08-09 10:30:01 -05:00
Chuck
4088807c72 milb_manager cache test 2025-08-09 10:22:56 -05:00
Chuck
f02ed06e09 update milb gamedate filed 2025-08-02 20:16:10 -05:00
Chuck
ac69569d77 logging for why milb api isn't working and cache updates to odds cache storage 2025-08-02 20:02:52 -05:00
Chuck
c490c5dca8 ensure displays share config file 2025-08-02 19:33:24 -05:00
Chuck
881a46867d milb combined live game status mapping that was causing confusion 2025-08-02 17:41:37 -05:00
Chuck
3c665c21d1 milb turn off test mode.... 2025-08-02 17:31:35 -05:00
Chuck
04009f78f7 milb diagnosis 2025-08-01 17:52:06 -05:00
Chuck
a6f8237069 adjust milb use of cache 2025-07-30 17:18:25 -05:00
Chuck
18b0a9703e remove all sports live displays from checking cache 2025-07-23 20:31:25 -05:00
Chuck
12dd1de858 fix utc timedate error in milb 2025-07-23 19:32:37 -05:00
Chuck
d928fcd5d6 switch milb upcoming flag from final to preview 2025-07-23 17:48:32 -05:00
Chuck
2199dd4e05 channel logo movement 2025-07-22 17:24:46 -05:00
Chuck
df3d010c65 toggleable short date format 2025-07-22 11:28:13 -05:00
Chuck
c3ded3999f game time formatting to remove space between time and AM/PM 2025-07-22 11:23:25 -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
4da2fd32e2 change weather logging, changed odds api call to only pull odds for games we will see, expanded game fetch window to see more games on odds ticker (50days from 30). 2025-07-22 09:31:14 -05:00
Chuck
78a63d5cea mlb and milb recent game debugging 2025-07-21 22:07:21 -05:00