Beispiel #1
0
shuffle = False  # Todo - We can prob get this from mopidy

while True:
    #####################
    ## PLAY
    #####################
    play_input = GPIO.input(PLAY_PIN)

    if play_input_prev != play_input and not play_input:
        print("Play Button Pressed")
        GPIO.output(LIGHT_PIN, GPIO.HIGH)

    elif not play_input:
        timer += 1
        if timer == 25:
            player.shuffle(shuffle)
            shuffle = not shuffle

    elif play_input_prev != play_input and play_input:
        print("Play Button Released")
        GPIO.output(LIGHT_PIN, GPIO.LOW)

        if timer < 25:
            state = player.get_state()
            if state == 'paused' or state == 'stopped':
                player.resume()
            else:
                player.pause()

        timer = 0
Beispiel #2
0
shuffle = False # Todo - We can prob get this from mopidy

while True:
    #####################
    ## PLAY 
    #####################
    play_input = GPIO.input(PLAY_PIN)

    if play_input_prev != play_input and not play_input:
        print("Play Button Pressed")
        GPIO.output(LIGHT_PIN, GPIO.HIGH)
	
    elif not play_input:
        timer += 1
        if timer == 25:
            player.shuffle(shuffle)
            shuffle = not shuffle

    elif play_input_prev != play_input and play_input:
        print("Play Button Released")
        GPIO.output(LIGHT_PIN, GPIO.LOW)

        if timer < 25:
            state = player.get_state()
            if state == 'paused' or state == 'stopped':
                player.resume()
            else:
                player.pause()

        timer = 0