diff --git a/docs/PLUGIN_CONFIGURATION_GUIDE.md b/docs/PLUGIN_CONFIGURATION_GUIDE.md index e8f8cb13..7471130a 100644 --- a/docs/PLUGIN_CONFIGURATION_GUIDE.md +++ b/docs/PLUGIN_CONFIGURATION_GUIDE.md @@ -184,37 +184,45 @@ plugin-repos/ ```json { + "id": "my-plugin", "name": "My Plugin", "version": "1.0.0", "description": "Plugin description", "author": "Your Name", + "entry_point": "manager.py", + "class_name": "MyPlugin", "display_modes": ["my_plugin"], - "config_schema": { - "type": "object", - "properties": { - "enabled": {"type": "boolean", "default": false}, - "update_interval": {"type": "integer", "default": 3600} - } - } + "config_schema": "config_schema.json" } ``` +The required fields the plugin loader will check for are `id`, +`name`, `version`, `class_name`, and `display_modes`. `entry_point` +defaults to `manager.py` if omitted. `config_schema` must be a +**file path** (relative to the plugin directory) — the schema itself +lives in a separate JSON file, not inline in the manifest. The +`class_name` value must match the actual class defined in the entry +point file **exactly** (case-sensitive, no spaces); otherwise the +loader fails with `AttributeError` at load time. + ### Plugin Manager Class ```python from src.plugin_system.base_plugin import BasePlugin -class MyPluginManager(BasePlugin): - def __init__(self, config, display_manager, cache_manager, font_manager): - super().__init__(config, display_manager, cache_manager, font_manager) - self.enabled = config.get('enabled', False) - +class MyPlugin(BasePlugin): + def __init__(self, plugin_id, config, display_manager, cache_manager, plugin_manager): + super().__init__(plugin_id, config, display_manager, cache_manager, plugin_manager) + # self.config, self.display_manager, self.cache_manager, + # self.plugin_manager, self.logger, and self.enabled are + # all set up by BasePlugin.__init__. + def update(self): - """Update plugin data""" + """Fetch/update data. Called based on update_interval.""" pass - + def display(self, force_clear=False): - """Display plugin content""" + """Render plugin content to the LED matrix.""" pass def get_duration(self): diff --git a/scripts/README_NBA_LOGOS.md b/scripts/README_NBA_LOGOS.md index 1a025cd5..8ae9b496 100644 --- a/scripts/README_NBA_LOGOS.md +++ b/scripts/README_NBA_LOGOS.md @@ -1,29 +1,40 @@ # NBA Logo Downloader -This script downloads all NBA team logos from the ESPN API and saves them in the `assets/sports/nba_logos/` directory for use with the NBA leaderboard. +This script downloads all NBA team logos from the ESPN API and saves +them in the `assets/sports/nba_logos/` directory. + +> **Heads up:** the NBA leaderboard and basketball scoreboards now +> live as plugins in the +> [`ledmatrix-plugins`](https://github.com/ChuckBuilds/ledmatrix-plugins) +> repo (`basketball-scoreboard`, `ledmatrix-leaderboard`). Those +> plugins download the logos they need automatically on first display. +> This standalone script is mainly useful when you want to pre-populate +> the assets directory ahead of time, or for development/debugging. + +All commands below should be run from the LEDMatrix project root. ## Usage ### Basic Usage ```bash -python download_nba_logos.py +python3 scripts/download_nba_logos.py ``` ### Force Re-download If you want to re-download all logos (even if they already exist): ```bash -python download_nba_logos.py --force +python3 scripts/download_nba_logos.py --force ``` ### Quiet Mode Reduce logging output: ```bash -python download_nba_logos.py --quiet +python3 scripts/download_nba_logos.py --quiet ``` ### Combined Options ```bash -python download_nba_logos.py --force --quiet +python3 scripts/download_nba_logos.py --force --quiet ``` ## What It Does @@ -82,12 +93,14 @@ assets/sports/nba_logos/ └── WAS.png # Washington Wizards ``` -## Integration with NBA Leaderboard +## Integration with NBA plugins -Once the logos are downloaded, the NBA leaderboard will: -- ✅ Use local logos instantly (no download delays) -- ✅ Display team logos in the scrolling leaderboard -- ✅ Show proper team branding for all 30 NBA teams +Once the logos are in `assets/sports/nba_logos/`, both the +`basketball-scoreboard` and `ledmatrix-leaderboard` plugins will pick +them up automatically and skip their own first-run download. This is +useful if you want to deploy a Pi without internet access to ESPN, or +if you want to preview the display on your dev machine without +waiting for downloads. ## Troubleshooting @@ -102,6 +115,6 @@ This is normal - some teams might have temporary API issues or the ESPN API migh ## Requirements -- Python 3.7+ -- `requests` library (should be installed with the project) +- Python 3.9+ (matches the project's overall minimum) +- `requests` library (already in `requirements.txt`) - Write access to `assets/sports/nba_logos/` directory