diff --git a/modes/score_mode.py b/modes/score_mode.py index 975e2ac..803fae1 100644 --- a/modes/score_mode.py +++ b/modes/score_mode.py @@ -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" diff --git a/scoreboard.py b/scoreboard.py index e400b52..bed2d54 100644 --- a/scoreboard.py +++ b/scoreboard.py @@ -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"]) diff --git a/utils/colors.py b/utils/colors.py new file mode 100644 index 0000000..2d9952b --- /dev/null +++ b/utils/colors.py @@ -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) \ No newline at end of file diff --git a/utils/data.py b/utils/data.py new file mode 100644 index 0000000..66e49af --- /dev/null +++ b/utils/data.py @@ -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")) + } +} \ No newline at end of file