separate more
This commit is contained in:
+2
-1
@@ -1,8 +1,9 @@
|
||||
import requests
|
||||
import utils.image_utils as image_utils
|
||||
from rgbmatrix import graphics
|
||||
from scoreboard import Colors, data
|
||||
from time import time, sleep
|
||||
from utils.colors import Colors
|
||||
from utils.data import data
|
||||
|
||||
def get_scores(sport, league):
|
||||
url = f"https://site.api.espn.com/apis/site/v2/sports/{sport}/{league}/scoreboard"
|
||||
|
||||
@@ -11,25 +11,6 @@ import modes.score_mode as score_mode
|
||||
# --- Load environment vars ---
|
||||
load_dotenv()
|
||||
|
||||
# --- Default vars ---
|
||||
SCRIPT_DIR = Path(__file__).parent.resolve()
|
||||
ASSET_DIR = os.path.join(SCRIPT_DIR, "assets")
|
||||
LOGO_DIR = os.path.join(ASSET_DIR, "logos")
|
||||
|
||||
# --- importable data dict ---
|
||||
data = {
|
||||
"paths": {
|
||||
"SCRIPT_DIR": SCRIPT_DIR,
|
||||
"ASSET_DIR": ASSET_DIR,
|
||||
"LOGO_DIR": LOGO_DIR
|
||||
},
|
||||
"fonts": {
|
||||
"font": graphics.Font().LoadFont(os.path.join(ASSET_DIR, "fonts/7x13.bdf")),
|
||||
"font_small": graphics.Font().LoadFont(os.path.join(ASSET_DIR, "fonts/5x7.bdf")),
|
||||
"font_big": graphics.Font().LoadFont(os.path.join(ASSET_DIR, "fonts/9x18.bdf"))
|
||||
}
|
||||
}
|
||||
|
||||
# --- Matrix config ---
|
||||
options = RGBMatrixOptions()
|
||||
options.rows = 32
|
||||
@@ -44,14 +25,6 @@ options.brightness = 80
|
||||
matrix = RGBMatrix(options=options)
|
||||
canvas = matrix.CreateFrameCanvas()
|
||||
|
||||
# --- Pre-built colors ---
|
||||
class Colors(Enum):
|
||||
WHITE = (255, 255, 255)
|
||||
YELLOW = (255, 200, 0)
|
||||
RED = (255, 50, 50)
|
||||
SABRES_BLUE = (0, 135, 48)
|
||||
SABRES_GOLD = (252, 20, 210)
|
||||
|
||||
# --- Govee API ---
|
||||
if os.environ['GOVEE_API_KEY']:
|
||||
govee_api = govee.GoveeApi(key=os.environ["GOVEE_API_KEY"])
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
from enum import Enum
|
||||
|
||||
# --- Pre-built colors ---
|
||||
class Colors(Enum):
|
||||
WHITE = (255, 255, 255)
|
||||
YELLOW = (255, 200, 0)
|
||||
RED = (255, 50, 50)
|
||||
SABRES_BLUE = (0, 135, 48)
|
||||
SABRES_GOLD = (252, 20, 210)
|
||||
@@ -0,0 +1,23 @@
|
||||
import os
|
||||
from pathlib import Path
|
||||
from rgbmatrix import graphics
|
||||
|
||||
|
||||
# --- Default vars ---
|
||||
SCRIPT_DIR = Path(__file__).parent.resolve()
|
||||
ASSET_DIR = os.path.join(SCRIPT_DIR, "assets")
|
||||
LOGO_DIR = os.path.join(ASSET_DIR, "logos")
|
||||
|
||||
# --- importable data dict ---
|
||||
data = {
|
||||
"paths": {
|
||||
"SCRIPT_DIR": SCRIPT_DIR,
|
||||
"ASSET_DIR": ASSET_DIR,
|
||||
"LOGO_DIR": LOGO_DIR
|
||||
},
|
||||
"fonts": {
|
||||
"font": graphics.Font().LoadFont(os.path.join(ASSET_DIR, "fonts/7x13.bdf")),
|
||||
"font_small": graphics.Font().LoadFont(os.path.join(ASSET_DIR, "fonts/5x7.bdf")),
|
||||
"font_big": graphics.Font().LoadFont(os.path.join(ASSET_DIR, "fonts/9x18.bdf"))
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user