mirror of
https://github.com/ChuckBuilds/LEDMatrix.git
synced 2026-04-10 21:03:01 +00:00
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:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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()
|
||||
|
||||
|
||||
@@ -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', [])
|
||||
|
||||
@@ -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', [])
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user