PDA

View Full Version : Example : Populate a tree from MP3's in a Folder and Output to textfile for playlist



TimeSurfer
01-13-2008, 01:20 PM
This is an example of how to populate mp3's to a tree object from a folder and output each file to a textfile for later use. [maybe a playlist]

This is a modified version of TristanD's example which is located here (http://www.indigorose.com/forums/showthread.php?t=18569&highlight=populate+tree)

On Global Functions:

function GetFolderContentsFromDialog()
folderbrowse = Dialog.FolderBrowse("Please select a folder:", _SourceDrive);
if (folderbrowse ~= "CANCEL") then
MP3 = File.Find(folderbrowse, "*.mp3", true, false, ShowSearchProgress, nil);
if MP3 then
for index, path in MP3 do
MP3path = path
TextFile.WriteFromString("AutoPlay\\Docs\\playlists\\default.txt", MP3path.."\r\n", true);
end
for i,v in MP3 do
tbSplit = String.SplitPath(v);
name = tbSplit.Filename
tblNodeData = {};
tblNodeData.Text = name;
tblNodeData.Data = v;
Tree.InsertNode("Tree1", "3", tblNodeData);
end
end
end
end

Button On Click Event:

GetFolderContentsFromDialog()

clubbcrusher
02-28-2009, 02:20 PM
:yes nice work, but whats the code for:

the root of autoplay audio and if youre running more albums and expand the tree, select youre track and audio load?

my scripting still noobie:o

JDog37
02-25-2010, 07:50 AM
Thank you TimeSurfer!! Nice work. ;):yes

Joe