Create Playlist From Folder

I hope i didn’t miss any hints on this particular topic on this forum, but does anyone got an idea what command might help me creating a playlist from one or more folder’s mp3 files ?

var
  pl: IPlaylist;

begin
  pl := Engine.CreatePlaylist;
  pl.InsertDirectory(0, 'c:\mp3\');
end.

(untested)

Note the trailing backslash in the directory name, it is mandatory.

Cool, how could i miss this simple command in the help file ???

Edit: I guess the zero is the position where the items get inserted, usefull in case there are already items in the playlist.

Thanks

Tadso

[code]var
ea: TExpandAction;

begin
ea:= eaFlat;
CurrentPlaylist.InsertDirectory(0, ‘D:\musik\1hb\A-F’, ea);
end.[/code]

ok, this one does the trick, it’s just also loading the .mmd files … back to thinking :stuck_out_tongue:
Funny thing is … it works with and without the backslash, your work is pretty resistend towards typos 8)

Edit: I think about loading the files into a temporary playlist and walk thru them to find and remove the .mmds, is there a command like substr(string, -3) that would return last 3 characters of the filename ? I’m not familiar with pascal anymore.

It’s reading MMD files? It should not. Definitely not. I will check that.

Usually, mAirList should know which files are audio file and which are not. That’s the same filter as used in the directory browsers.