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

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • TimeSurfer
    Forum Member
    • Dec 2007
    • 479

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

    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

    On Global Functions:
    Code:
    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:
    Code:
    GetFolderContentsFromDialog()
  • clubbcrusher
    Forum Member
    • Jun 2006
    • 19

    #2
    :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

    Comment

    • JDog37
      No longer a forum member
      • Feb 2008
      • 566

      #3
      Nice

      Thank you TimeSurfer!! Nice work. :yes

      Joe

      Comment

      Working...
      X