get disc data once
This commit is contained in:
parent
93ee1a8eff
commit
947477892a
@ -35,11 +35,11 @@ def button_callback_2(channel):
|
|||||||
def button_callback_3(channel):
|
def button_callback_3(channel):
|
||||||
start_time = time.time()
|
start_time = time.time()
|
||||||
client = create_client()
|
client = create_client()
|
||||||
|
disc_data = check_current_disc(client)
|
||||||
# Wait until the button is released or held for more than 3 seconds
|
# Wait until the button is released or held for more than 3 seconds
|
||||||
while GPIO.input(BUTTON_PINS[2]) == GPIO.LOW: # Button is pressed (active low)
|
while GPIO.input(BUTTON_PINS[2]) == GPIO.LOW: # Button is pressed (active low)
|
||||||
if time.time() - start_time >= 3: # Check if 3 seconds have passed
|
if time.time() - start_time >= 3: # Check if 3 seconds have passed
|
||||||
print("Button 3 held for 3 seconds! Sending RADIO2.")
|
print("Button 3 held for 3 seconds! Sending RADIO2.")
|
||||||
disc_data = check_current_disc(client)
|
|
||||||
update_disc(client, ["ytmusic",disc_data['name'],disc_data['type'],"RESET"])
|
update_disc(client, ["ytmusic",disc_data['name'],disc_data['type'],"RESET"])
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
update_disc(client, ["ytmusic",disc_data['name'],disc_data['type'],disc_data['id']])
|
update_disc(client, ["ytmusic",disc_data['name'],disc_data['type'],disc_data['id']])
|
||||||
|
Loading…
x
Reference in New Issue
Block a user