diff --git a/scoreboard.py b/scoreboard.py index 6878f59..cdf342b 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 @@ -53,6 +54,16 @@ logo_cache = {} # --- Govee API --- govee_api = govee.GoveeApi(device_ip=GOVEE_IP) +# -- PyGame for Audio -- +pygame.mixer.init() + +def play_goal_horn(): + try: + pygame.mixer.music.load("/usr/local/share/horn.mp3") + pygame.mixer.music.play() + except Exception as e: + print(f"Audio error: {e}") + 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) @@ -121,6 +132,8 @@ def play_goal_celebration(): WHITE = (255, 255, 255) # unchanged TEXT = "SABRES GOAL!" + play_goal_horn() + # Phase 1: zoom in from tiny to full, alternating bg color zoom_steps = [0.1, 0.2, 0.35, 0.5, 0.65, 0.8, 0.95, 1.1, 1.0] for i, scale in enumerate(zoom_steps): diff --git a/test.py b/test.py deleted file mode 100644 index ca79cb0..0000000 --- a/test.py +++ /dev/null @@ -1,12 +0,0 @@ -from govee import GoveeApi -from time import sleep - -GOVEE_DEVICE = "3D:22:D7:94:40:46:2F:72" -GOVEE_SKU = "H6168" -GOVEE_AWS = "owABAgT/AGQMACr//+YAADb//8k=,o//QAAIDAwAAAAAAAAAAAAAAAI4=,MwUKdwAAAAAAAAAAAAAAAAAAAEs=" -GOVEE_IP = "172.16.0.15" - -govee_api = GoveeApi(device_ip=GOVEE_IP) -govee_api.send_scene(GOVEE_AWS) -# sleep(5) -# govee_api.set_?to_original_color() \ No newline at end of file