-
-
Notifications
You must be signed in to change notification settings - Fork 5
fix(timezone): ESPN API date anchoring and local time display for all sports plugins #43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
203760c
699ea4e
f175037
0bd2ef5
97c47d8
a4cebeb
70664b8
afb4fbd
7e73d30
c83012d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -93,6 +93,16 @@ def __init__( | |
|
|
||
| self.logger = logger | ||
|
|
||
| # Resolve timezone: plugin config → global config → UTC. | ||
| # Inject into self.config so all sub-components (scroll display, game | ||
| # renderer, etc.) can read it via config.get('timezone'). | ||
| if not self.config.get("timezone"): | ||
| try: | ||
| global_tz = cache_manager.config_manager.get_timezone() | ||
| except Exception: | ||
| global_tz = "UTC" | ||
|
Comment on lines
+100
to
+103
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: rg -n -C5 'except Exception' plugins/baseball-scoreboard/manager.pyRepository: ChuckBuilds/ledmatrix-plugins Length of output: 9060 🏁 Script executed: cat -n plugins/baseball-scoreboard/manager.py | sed -n '95,110p'Repository: ChuckBuilds/ledmatrix-plugins Length of output: 946 🏁 Script executed: # Check if self.logger is initialized before line 100
rg -n 'self.logger' plugins/baseball-scoreboard/manager.py | head -20Repository: ChuckBuilds/ledmatrix-plugins Length of output: 1494 Add logging to timezone resolution fallback to match error handling patterns elsewhere in this file. Line 102 silently swallows exceptions during timezone resolution, making configuration failures invisible. This is inconsistent with all other exception handlers in this file, which log the error and exception. Catch the exception and log it before falling back to UTC. 🧰 Tools🪛 Ruff (0.15.2)[warning] 102-102: Do not catch blind exception: (BLE001) 🤖 Prompt for AI Agents |
||
| self.config["timezone"] = global_tz or "UTC" | ||
|
|
||
| # Basic configuration | ||
| self.is_enabled = config.get("enabled", True) | ||
| # Get display dimensions from display_manager properties | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -185,7 +185,8 @@ def _get_scroll_settings(self, league: Optional[str] = None) -> Dict[str, Any]: | |
| "scroll_delay": 0.01, | ||
| "gap_between_games": 48, | ||
| "show_league_separators": True, | ||
| "dynamic_duration": True | ||
| "dynamic_duration": True, | ||
| "game_card_width": 128, | ||
| } | ||
|
|
||
| # Try to get league-specific settings first | ||
|
|
@@ -215,15 +216,21 @@ def _get_scroll_settings(self, league: Optional[str] = None) -> Dict[str, Any]: | |
|
|
||
| return defaults | ||
|
|
||
| def _get_game_renderer(self) -> Optional[GameRenderer]: | ||
| """Get or create the cached GameRenderer instance.""" | ||
| def _get_game_renderer(self, game_card_width: int = 128) -> Optional[GameRenderer]: | ||
| """Get or create the cached GameRenderer instance. | ||
|
|
||
| Args: | ||
| game_card_width: Width for each game card. Cached renderer is recreated | ||
| if this differs from the current renderer's width. | ||
| """ | ||
| if GameRenderer is None: | ||
| self.logger.error("GameRenderer not available") | ||
| return None | ||
|
|
||
| if self._game_renderer is None: | ||
| # Recreate renderer if card width changed (e.g. config update) | ||
| if self._game_renderer is None or getattr(self._game_renderer, "display_width", None) != game_card_width: | ||
| self._game_renderer = GameRenderer( | ||
| self.display_width, | ||
| game_card_width, | ||
| self.display_height, | ||
| self.config, | ||
| logo_cache=self._logo_cache, | ||
|
|
@@ -329,9 +336,11 @@ def prepare_scroll_content( | |
| scroll_settings = self._get_scroll_settings() | ||
| gap_between_games = scroll_settings.get("gap_between_games", 24) | ||
| show_separators = scroll_settings.get("show_league_separators", True) | ||
| game_card_width = scroll_settings.get("game_card_width", 128) | ||
|
|
||
| # Get or create cached game renderer | ||
| renderer = self._get_game_renderer() | ||
| # Get or create cached game renderer using game_card_width so cards are a fixed | ||
| # size regardless of the full chain width (display_width may span multiple panels) | ||
| renderer = self._get_game_renderer(game_card_width) | ||
|
|
||
|
Comment on lines
+341
to
344
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fail fast if On Line 343, 🛠️ Suggested fix renderer = self._get_game_renderer(game_card_width)
+ if renderer is None:
+ self._vegas_content_items = []
+ self._is_scrolling = False
+ return False
# Pass rankings cache to renderer if available
if renderer and rankings_cache:
renderer.set_rankings_cache(rankings_cache)Also applies to: 374-389 🤖 Prompt for AI Agents |
||
| # Pass rankings cache to renderer if available | ||
| if renderer and rankings_cache: | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
Repository: ChuckBuilds/ledmatrix-plugins
Length of output: 227
Bump manifest version to 1.6.0 for MINOR release.
New backward-compatible config options (
game_card_widthacross multiple league blocks at lines 129–135, 467–473, 805–811) require a MINOR version bump, not PATCH. Updateplugins/baseball-scoreboard/manifest.jsonto version1.6.0with the entry placed first in theversionsarray per semantic versioning guidelines for new features.🤖 Prompt for AI Agents