Karl Hudgell преди 6 месеца
родител
ревизия
304a0241fa
променени са 1 файла, в които са добавени 2 реда и са изтрити 3 реда
  1. 2 3
      buttons.py

+ 2 - 3
buttons.py

@@ -17,13 +17,12 @@ for pin in BUTTON_PINS:
 
 # Callback functions to handle button presses
 def button_callback_1(channel):
-    if check_current_status() == "PLAY":
+    client = create_client()
+    if check_current_status(client) == "PLAY":
         print("Button 1 pressed! Pausing playback.")
-        client = create_client()
         control_player(client, "PAUSE")
     else:
         print("Button 1 pressed! Playing.")
-        client = create_client()
         control_player(client, "PLAY")
 
 def button_callback_2(channel):