I am trying to create a very simple program that makes a list of the music
files in a folder, sorts the files into alphabetical order and then plays each
file in the folder. The program below plays the first file in the folder and
then freezes without playing any of the remaining songs.
--------------------------------------------------------------------------------
import pygame, os
def findFiles(location):
files = []
for item in os.listdir(location):
files.append(item)
files.sort()
return files
def playMusic(music)
clock=pygame.time.Clock()
pygame.mixer.music.load(music)
pygame.mixer.music.play(0, 0.0)
while pygame.mixer.music.get_busy():
clock.tick(300)
return
def main():
pygame.init()
pygame.mixer.init()
destinationPath = "/home/owner/Desktop/playList"
os.chdir(destinationPath)
playList = []
playList = findFiles(destinationPath)
for item in playList:
playMusic(item)
--------------------------------------------------------------------------------------------
Jason