Author |
Message |
metachief
![](http://compsci.ca/v3/uploads/user_avatars/59969875948ed1e6be9fb0.jpg)
|
Posted: Fri Jun 06, 2008 9:21 am Post subject: 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. |
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
apomb
![](http://compsci.ca/v3/uploads/user_avatars/6489609347028a0f2422f.png)
|
Posted: Fri Jun 06, 2008 9:30 am Post subject: RE:Reading files in a folder |
|
|
try a little
on for size
EDIT: Relative path instead ... |
|
|
|
|
![](images/spacer.gif) |
metachief
![](http://compsci.ca/v3/uploads/user_avatars/59969875948ed1e6be9fb0.jpg)
|
Posted: Fri Jun 06, 2008 9:46 am Post subject: 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. |
|
|
|
|
![](images/spacer.gif) |
apomb
![](http://compsci.ca/v3/uploads/user_avatars/6489609347028a0f2422f.png)
|
Posted: Fri Jun 06, 2008 9:52 am Post subject: 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. |
|
|
|
|
![](images/spacer.gif) |
metachief
![](http://compsci.ca/v3/uploads/user_avatars/59969875948ed1e6be9fb0.jpg)
|
Posted: Fri Jun 06, 2008 2:47 pm Post subject: 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. |
|
|
|
|
![](images/spacer.gif) |
apomb
![](http://compsci.ca/v3/uploads/user_avatars/6489609347028a0f2422f.png)
|
Posted: Fri Jun 06, 2008 3:04 pm Post subject: RE:Reading files in a folder |
|
|
yes it is...
just read each line in, assign each to an array element, and VOILA.
then do a
Turing: | loop
music.playfile(array[x])
end loop |
|
|
|
|
|
![](images/spacer.gif) |
metachief
![](http://compsci.ca/v3/uploads/user_avatars/59969875948ed1e6be9fb0.jpg)
|
Posted: Fri Jun 06, 2008 4:21 pm Post subject: 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... |
|
|
|
|
![](images/spacer.gif) |
riveryu
![](http://compsci.ca/v3/uploads/user_avatars/196991102647ae2debe0bf0.jpg)
|
Posted: Fri Jun 06, 2008 4:48 pm Post subject: 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. |
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
apomb
![](http://compsci.ca/v3/uploads/user_avatars/6489609347028a0f2422f.png)
|
Posted: Fri Jun 06, 2008 10:14 pm Post subject: 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. |
|
|
|
|
![](images/spacer.gif) |
metachief
![](http://compsci.ca/v3/uploads/user_avatars/59969875948ed1e6be9fb0.jpg)
|
Posted: Sat Jun 07, 2008 11:39 pm Post subject: RE:Reading files in a folder |
|
|
Thanks for the help guys. |
|
|
|
|
![](images/spacer.gif) |
|