This commit is contained in:
2026-05-02 22:21:12 -04:00
parent e806822dae
commit 221d9a87ec
2 changed files with 13 additions and 12 deletions
+13
View File
@@ -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):