def gerarPlaylist():
    file = open("playlist.txt", "r")
    newPlaylist = file.read().split("\n")
    random.shuffle(newPlaylist)
    newFile = open("novaPlaylist.txt", "w")
    for musica in newPlaylist:
        if(len(musica) > 0):
            newFile.write(musica + "\n")
			
	file.close();
	newFile.close();

# criação de componentes
player = Player();
player.volume = 30;
gerarPlaylist();
player.loadlist("novaPlaylist.txt");
player.volume = 30;
botao1 = Button(11);
botao2 = Button(12);
botao3 = Button(13);
led1 = LED(21);
led3 = LED(23);
lcd = Adafruit_CharLCD(2, 3, 4, 5, 6, 7, 16, 2);

player.pause()
led1.blink()

botao2.when_pressed = tocarPausarMusica;
botao3.when_held = acelerarMusica;
예제 #2
0
        player.pt_step(-1)
    else:
        player.time_pos = 0


def exibirFaixa():
    metadados = player.metadata
    if (metadados):
        faixa = player.metadata["Title"]
        lcd.clear()
        lcd.message(faixa)


# criação de componentes
player = Player()
player.volume = 30
player.loadlist("playlist.txt")
player.volume = 30
botao1 = Button(11)
botao2 = Button(12)
botao3 = Button(13)
led1 = LED(21)
led3 = LED(23)
lcd = Adafruit_CharLCD(2, 3, 4, 5, 6, 7, 16, 2)

player.pause()
led1.blink()

botao2.when_pressed = tocarPausarMusica
botao3.when_pressed = proxFaixa
botao1.when_pressed = voltarFaixa