mirror of
https://github.com/ChuckBuilds/LEDMatrix.git
synced 2026-08-06 19:28:06 +00:00
fix(scripts): repair broken sys.path setup in utility scripts
clear_cache.py and download_nba_logos.py pointed sys.path at a 'src' directory relative to the script's own folder (scripts/utils/src and scripts/src — neither exists), so both crashed on import; they now insert the project root and import via the src package like the other scripts. debug_web_manual.py resolved 'project root' to scripts/debug/ instead of two levels up. fix_nhl_cache.sh is removed: it used Python docstring syntax in a bash script and invoked clear_nhl_cache.py, which does not exist anywhere in the repo — it cannot ever have worked in its current location. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SXb4mKcAkVaxkeTb3YnAdr
This commit is contained in:
@@ -13,8 +13,8 @@ def main():
|
|||||||
print("🔍 LED Matrix Web Interface Debug Tool")
|
print("🔍 LED Matrix Web Interface Debug Tool")
|
||||||
print("=" * 50)
|
print("=" * 50)
|
||||||
|
|
||||||
# Change to project root (where this script is located)
|
# Change to project root (two levels up from scripts/debug/)
|
||||||
project_root = Path(__file__).parent.resolve()
|
project_root = Path(__file__).parent.parent.parent.resolve()
|
||||||
os.chdir(project_root)
|
os.chdir(project_root)
|
||||||
print(f"📁 Working directory: {os.getcwd()}")
|
print(f"📁 Working directory: {os.getcwd()}")
|
||||||
|
|
||||||
|
|||||||
@@ -7,8 +7,8 @@ import os
|
|||||||
import logging
|
import logging
|
||||||
from typing import Tuple
|
from typing import Tuple
|
||||||
|
|
||||||
# Add the src directory to Python path so we can import the logo downloader
|
# Add the project root to Python path so we can import the logo downloader
|
||||||
sys.path.insert(0, os.path.join(os.path.dirname(__file__), 'src'))
|
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
||||||
|
|
||||||
# Set up logging
|
# Set up logging
|
||||||
logging.basicConfig(
|
logging.basicConfig(
|
||||||
@@ -28,7 +28,7 @@ def download_nba_logos(force_download: bool = False) -> Tuple[int, int]:
|
|||||||
Tuple of (downloaded_count, failed_count)
|
Tuple of (downloaded_count, failed_count)
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
from logo_downloader import download_all_logos_for_league
|
from src.logo_downloader import download_all_logos_for_league
|
||||||
|
|
||||||
logger.info("🏀 Starting NBA logo download...")
|
logger.info("🏀 Starting NBA logo download...")
|
||||||
logger.info(f"Target directory: assets/sports/nba_logos/")
|
logger.info(f"Target directory: assets/sports/nba_logos/")
|
||||||
|
|||||||
@@ -31,9 +31,6 @@ owned by the `ledmatrix` service user or by `root`.
|
|||||||
systemd journal access, and the sudoers entries the web interface
|
systemd journal access, and the sudoers entries the web interface
|
||||||
needs to control the display service.
|
needs to control the display service.
|
||||||
|
|
||||||
- **`fix_nhl_cache.sh`** — Targeted fix for NHL plugin cache issues
|
|
||||||
(clears the NHL cache and restarts the display service).
|
|
||||||
|
|
||||||
- **`safe_plugin_rm.sh`** — Validates that a plugin removal path is
|
- **`safe_plugin_rm.sh`** — Validates that a plugin removal path is
|
||||||
inside an allowed base directory before deleting it. Used by the web
|
inside an allowed base directory before deleting it. Used by the web
|
||||||
interface (via sudo) when a user clicks **Uninstall** on a plugin —
|
interface (via sudo) when a user clicks **Uninstall** on a plugin —
|
||||||
|
|||||||
@@ -1,21 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
"""
|
|
||||||
Script to fix NHL cache issues on Raspberry Pi.
|
|
||||||
This will clear the NHL cache and restart the display service.
|
|
||||||
"""
|
|
||||||
|
|
||||||
echo "=========================================="
|
|
||||||
echo "Fixing NHL Cache Issues"
|
|
||||||
echo "=========================================="
|
|
||||||
|
|
||||||
# Clear NHL cache
|
|
||||||
echo "Clearing NHL cache..."
|
|
||||||
python3 clear_nhl_cache.py
|
|
||||||
|
|
||||||
# Restart the display service to force fresh data fetch
|
|
||||||
echo "Restarting display service..."
|
|
||||||
sudo systemctl restart ledmatrix.service
|
|
||||||
|
|
||||||
echo "NHL cache cleared and service restarted!"
|
|
||||||
echo "NHL managers should now fetch fresh data from ESPN API."
|
|
||||||
echo "Check the logs to see if NHL games are now being displayed."
|
|
||||||
@@ -8,10 +8,10 @@ import os
|
|||||||
import sys
|
import sys
|
||||||
import argparse
|
import argparse
|
||||||
|
|
||||||
# Add the src directory to the path so we can import our modules
|
# Add the project root to the path so we can import our modules
|
||||||
sys.path.insert(0, os.path.join(os.path.dirname(__file__), 'src'))
|
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))
|
||||||
|
|
||||||
from cache_manager import CacheManager
|
from src.cache_manager import CacheManager
|
||||||
|
|
||||||
def list_cache_keys(cache_manager):
|
def list_cache_keys(cache_manager):
|
||||||
"""List all available cache keys."""
|
"""List all available cache keys."""
|
||||||
|
|||||||
Reference in New Issue
Block a user