Estoy haciendo un reproducor en python3, y tengo un pequeño problema.
La cosa es que quiero reproducir una serie de canciones las cuales estan en una lista, ya saben, hice lo que cualquiera haria, poner un for y dentro de ese for que vaya tomando el string y vaya reproduciendo todo... Pero no funciona
Les dejo el codigo
Código:
#Librerias
#pygame
#mutagen
#tinytag
from pygame import mixer
from mutagen.mp3 import MP3
from tinytag import TinyTag
import os
import time
clear = lambda :(os.system("clear"))
songs = ["path_song","path_song2"]
mixer.init()
for song in songs:
tag = TinyTag.get(song)
mixer.music.load(song)
mixer.music.set_volume(0.2)
mixer.music.play()
song_duration = MP3(song)
song_duration = song_duration.info.length
song_duration = round(song_duration)
def duration_time(song_duration):
end_minute = 0
end_beginning = 0
end_aux_duration = 0
while True:
if end_aux_duration == song_duration:
break
else:
end_beginning = end_beginning + 1
end_aux_duration = end_aux_duration + 1
if end_beginning == 60:
end_minute = end_minute + 1
end_beginning = end_beginning - 60
end_aux_duration = str(end_minute),":",str(end_beginning).zfill(2)
end_duration = "".join(end_aux_duration)
minute = 0
beginning = 0
aux_duration = 0
while True:
if aux_duration == song_duration:
break
else:
beginning = beginning + 1
aux_duration = aux_duration + 1
time.sleep(1)
clear()
if beginning == 60:
minute = minute + 1
beginning = beginning - 60
print(f"{minute}:",f"{beginning}".zfill(2), " ------ O ------ ",end_duration)
duration_time(song_duration)
Gracias!!!