mirror of
https://github.com/ChuckBuilds/LEDMatrix.git
synced 2026-04-10 13:02:59 +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:
1
requirements-emulator.txt
Normal file
1
requirements-emulator.txt
Normal file
@@ -0,0 +1 @@
|
|||||||
|
RGBMatrixEmulator
|
||||||
@@ -9,7 +9,6 @@ from googleapiclient.discovery import build
|
|||||||
import pickle
|
import pickle
|
||||||
from PIL import Image, ImageDraw, ImageFont
|
from PIL import Image, ImageDraw, ImageFont
|
||||||
import numpy as np
|
import numpy as np
|
||||||
from rgbmatrix import graphics
|
|
||||||
import pytz
|
import pytz
|
||||||
from src.config_manager import ConfigManager
|
from src.config_manager import ConfigManager
|
||||||
import time
|
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
|
from PIL import Image, ImageDraw, ImageFont
|
||||||
import time
|
import time
|
||||||
from typing import Dict, Any, List, Tuple
|
from typing import Dict, Any, List, Tuple
|
||||||
|
|||||||
@@ -161,7 +161,7 @@ class LogoDownloader:
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
logger.info(f"Fetching team data for {league} from ESPN API...")
|
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()
|
response.raise_for_status()
|
||||||
data = response.json()
|
data = response.json()
|
||||||
|
|
||||||
|
|||||||
@@ -229,8 +229,8 @@ class BaseNCAAFBManager: # Renamed class
|
|||||||
|
|
||||||
self.logger.info(f"[NCAAFB] Fetching full {year} season schedule from ESPN API...")
|
self.logger.info(f"[NCAAFB] Fetching full {year} season schedule from ESPN API...")
|
||||||
try:
|
try:
|
||||||
url = f"https://site.api.espn.com/apis/site/v2/sports/football/college-football/scoreboard?dates={year}&seasontype=2"
|
url = f"https://site.api.espn.com/apis/site/v2/sports/football/college-football/scoreboard"
|
||||||
response = self.session.get(url, headers=self.headers, timeout=15)
|
response = self.session.get(url, params={"dates": year,"seasontype":2,"limit":1000},headers=self.headers, timeout=15)
|
||||||
response.raise_for_status()
|
response.raise_for_status()
|
||||||
data = response.json()
|
data = response.json()
|
||||||
events = data.get('events', [])
|
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})...")
|
self.logger.info(f"[NFL] Fetching full {current_year} season schedule from ESPN API (cache_enabled={use_cache})...")
|
||||||
try:
|
try:
|
||||||
url = f"https://site.api.espn.com/apis/site/v2/sports/football/nfl/scoreboard?dates={current_year}"
|
url = f"https://site.api.espn.com/apis/site/v2/sports/football/nfl/scoreboard"
|
||||||
response = self.session.get(url, headers=self.headers, timeout=15)
|
response = self.session.get(url, params={"dates": current_year, "limit":1000}, headers=self.headers, timeout=15)
|
||||||
response.raise_for_status()
|
response.raise_for_status()
|
||||||
data = response.json()
|
data = response.json()
|
||||||
events = data.get('events', [])
|
events = data.get('events', [])
|
||||||
|
|||||||
@@ -1,11 +1,8 @@
|
|||||||
import os
|
import os
|
||||||
import json
|
import json
|
||||||
import logging
|
import logging
|
||||||
from datetime import datetime, date
|
from datetime import date
|
||||||
from PIL import Image, ImageDraw, ImageFont
|
from PIL import ImageDraw, ImageFont
|
||||||
import numpy as np
|
|
||||||
from rgbmatrix import graphics
|
|
||||||
import pytz
|
|
||||||
from src.config_manager import ConfigManager
|
from src.config_manager import ConfigManager
|
||||||
import time
|
import time
|
||||||
import freetype
|
import freetype
|
||||||
|
|||||||
@@ -4,8 +4,6 @@ import time
|
|||||||
import logging
|
import logging
|
||||||
from PIL import Image, ImageDraw, ImageFont
|
from PIL import Image, ImageDraw, ImageFont
|
||||||
import requests
|
import requests
|
||||||
from rgbmatrix import RGBMatrix, RGBMatrixOptions
|
|
||||||
import os
|
|
||||||
from typing import Dict, Any
|
from typing import Dict, Any
|
||||||
|
|
||||||
# Import the API counter function from web interface
|
# Import the API counter function from web interface
|
||||||
|
|||||||
Reference in New Issue
Block a user