
-----------------------------------
metachief
Fri Jun 06, 2008 9:21 am

Reading files in a folder
-----------------------------------
I was trying to make a music player a while ago, but gave up because I could not figure out how to read music files from a folder. I know making a music player with turing is a stupid idea, but I'm just experimenting... Anyway if anyone could help me with this it would be great.

-----------------------------------
apomb
Fri Jun 06, 2008 9:30 am

RE:Reading files in a folder
-----------------------------------
try a little 
Music.PlayFile()
on for size ;)
EDIT: Relative path instead ...

-----------------------------------
metachief
Fri Jun 06, 2008 9:46 am

RE:Reading files in a folder
-----------------------------------
Thats obvious, but iwas look more for a way to list all of the files in the folder as a list on the music playlist.

-----------------------------------
apomb
Fri Jun 06, 2008 9:52 am

RE:Reading files in a folder
-----------------------------------
ah, then you would simply have an array of filenames read in from a playlist file and that variable would then be substituted in for the file to play.

This is problem Solving 101.

-----------------------------------
metachief
Fri Jun 06, 2008 2:47 pm

RE:Reading files in a folder
-----------------------------------
how would i go about reading and storing the names in the folder into the array. that was my question. it's not like a text document where you can use the command open.

-----------------------------------
apomb
Fri Jun 06, 2008 3:04 pm

RE:Reading files in a folder
-----------------------------------
yes it is... 
openfile
just read each line in, assign each to an array element, and VOILA.

then do a 
loop
music.playfile(array

-----------------------------------
metachief
Fri Jun 06, 2008 4:21 pm

RE:Reading files in a folder
-----------------------------------
But how do i get th elist of files from the folder with turing. Without specifying the file names my self. Same thing as reading the words in a text document except in a folder composed of music files...

-----------------------------------
riveryu
Fri Jun 06, 2008 4:48 pm

RE:Reading files in a folder
-----------------------------------
Use Turing's Dir.Get to determine the filenames and type by their extension, store them in an array. Then play music to them according to user choice. Be sure to have a solid background on the Dir module though.

-----------------------------------
apomb
Fri Jun 06, 2008 10:14 pm

RE:Reading files in a folder
-----------------------------------
Oh ok, i thought you were wanting to create a playlist in a file, using the music file names, then read that list... sorry for the misunderstanding, and yes, the Dir. module would work just as riveryu says.

-----------------------------------
metachief
Sat Jun 07, 2008 11:39 pm

RE:Reading files in a folder
-----------------------------------
Thanks for the help guys.
