Add Emulator Support (#35)

* Add emulator

* Update limit for ESPM API

* use params

---------

Co-authored-by: Alex Resnick <adr8282@gmail.com>
This commit is contained in:
Alex Resnick
2025-09-14 15:44:50 -05:00
committed by GitHub
parent b82e904cb1
commit a5a9398c5c
8 changed files with 13 additions and 14 deletions

View File

@@ -0,0 +1 @@
RGBMatrixEmulator

View File

@@ -9,7 +9,6 @@ from googleapiclient.discovery import build
import pickle
from PIL import Image, ImageDraw, ImageFont
import numpy as np
from rgbmatrix import graphics
import pytz
from src.config_manager import ConfigManager
import time

View File

@@ -1,4 +1,8 @@
from rgbmatrix import RGBMatrix, RGBMatrixOptions
import os
if os.getenv("EMULATOR", "false") == "true":
from RGBMatrixEmulator import RGBMatrix, RGBMatrixOptions
else:
from rgbmatrix import RGBMatrix, RGBMatrixOptions
from PIL import Image, ImageDraw, ImageFont
import time
from typing import Dict, Any, List, Tuple

View File

@@ -161,7 +161,7 @@ class LogoDownloader:
try:
logger.info(f"Fetching team data for {league} from ESPN API...")
response = self.session.get(api_url, headers=self.headers, timeout=self.request_timeout)
response = self.session.get(api_url, params={'limit':1000},headers=self.headers, timeout=self.request_timeout)
response.raise_for_status()
data = response.json()

View File

@@ -229,8 +229,8 @@ class BaseNCAAFBManager: # Renamed class
self.logger.info(f"[NCAAFB] Fetching full {year} season schedule from ESPN API...")
try:
url = f"https://site.api.espn.com/apis/site/v2/sports/football/college-football/scoreboard?dates={year}&seasontype=2"
response = self.session.get(url, headers=self.headers, timeout=15)
url = f"https://site.api.espn.com/apis/site/v2/sports/football/college-football/scoreboard"
response = self.session.get(url, params={"dates": year,"seasontype":2,"limit":1000},headers=self.headers, timeout=15)
response.raise_for_status()
data = response.json()
events = data.get('events', [])

View File

@@ -154,8 +154,8 @@ class BaseNFLManager: # Renamed class
self.logger.info(f"[NFL] Fetching full {current_year} season schedule from ESPN API (cache_enabled={use_cache})...")
try:
url = f"https://site.api.espn.com/apis/site/v2/sports/football/nfl/scoreboard?dates={current_year}"
response = self.session.get(url, headers=self.headers, timeout=15)
url = f"https://site.api.espn.com/apis/site/v2/sports/football/nfl/scoreboard"
response = self.session.get(url, params={"dates": current_year, "limit":1000}, headers=self.headers, timeout=15)
response.raise_for_status()
data = response.json()
events = data.get('events', [])

View File

@@ -1,11 +1,8 @@
import os
import json
import logging
from datetime import datetime, date
from PIL import Image, ImageDraw, ImageFont
import numpy as np
from rgbmatrix import graphics
import pytz
from datetime import date
from PIL import ImageDraw, ImageFont
from src.config_manager import ConfigManager
import time
import freetype

View File

@@ -4,8 +4,6 @@ import time
import logging
from PIL import Image, ImageDraw, ImageFont
import requests
from rgbmatrix import RGBMatrix, RGBMatrixOptions
import os
from typing import Dict, Any
# Import the API counter function from web interface