diff --git a/scoreboard.py b/scoreboard.py index 2c8084b..fee4692 100644 --- a/scoreboard.py +++ b/scoreboard.py @@ -2,6 +2,7 @@ import time import requests import os import govee +import pygame from time import sleep from PIL import Image, ImageDraw, ImageFont from rgbmatrix import RGBMatrix, RGBMatrixOptions, graphics @@ -51,6 +52,13 @@ logo_cache = {} # --- Govee API --- govee_api = govee.GoveeApi(key="") +# --- PyGame Audio --- +pygame.mixer.init() + +def play_goal_horn(): + pygame.mixer.music.load("/usr/local/share/horn.mp3") + pygame.mixer.music.play() + def render_goal_frame(text, text_scale, bg_color, text_color): big_h = max(8, int(32 * text_scale)) big_img = Image.new("RGB", (1024, 128), bg_color) @@ -289,6 +297,7 @@ def run(): last_switch = time.time() while True: + play_goal_horn() govee_api.set_diy_scene(GOVEE_SKU, GOVEE_DEVICE) play_goal_celebration() govee_api.set_to_original_color(GOVEE_SKU, GOVEE_DEVICE)