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): | ||||
|     start_time = time.time() | ||||
|     client = create_client()     | ||||
|     disc_data = check_current_disc(client) | ||||
|     # 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) | ||||
|         if time.time() - start_time >= 3:  # Check if 3 seconds have passed | ||||
|             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"]) | ||||
|             time.sleep(1) | ||||
|             update_disc(client, ["ytmusic",disc_data['name'],disc_data['type'],disc_data['id']]) | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Karl Hudgell
						Karl Hudgell