readd audio

This commit is contained in:
2026-05-02 23:50:15 -04:00
parent 43a22359df
commit 2faa7b7982
+9
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
@@ -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)