procedure TForm1.ScanClick(Sender: TObject); var s:String;
procedure AddF; var s1,s2:String; sr:TSearchRec; begin if FindFirst(s+'*.*',faHidden+faReadOnly,sr)=0 then begin repeat s1:=s+sr.Name; s2:=ExtractFileExt(s1); if s2<>'' then s2:=s2+';'; if ContainsText('*.mp3;*.ape;*.tak;*.aac;*.flac;*.m4a;*.ogg;*.wav;',s2) then if FileExists(s1) then MList.Items.Add(s1); until FindNext(sr)<>0; FindClose(sr); end; end;
procedure FindF; var t:String; b:Boolean; sr:TSearchRec; begin if FindFirst(s+'*',faDirectory,sr)=0 then begin repeat t:=s; s:=s+sr.Name+PathDelim; b:=DirectoryExists(s) and (sr.Name[1]<>'.'); if b then begin AddF; FindF; end; s:=t; until FindNext(sr)<>0; FindClose(sr); end; end;
begin s:=TPath.GetDocumentsPath+PathDelim; AddF; FindF; s:=TPath.GetSharedDocumentsPath+PathDelim; AddF; FindF; end;
procedure TForm1.ScanClick(Sender: TObject); var s:String;
procedure AddF; var s1,s2:String; files : TStringDynArray; i:Integer; begin files := TDirectory.GetFiles (s);
for i := 0 to length(files)-1 do begin s1:=s+files[i]; s2:=ExtractFileExt(s1); if s2<>'' then s2:=s2+';'; if ContainsText('*.mp3;*.ape;*.tak;*.aac;*.flac;*.m4a;*.ogg;*.wav',s2) then MList.Items.Add(s1); end; end;
procedure FindF; var t:String; b:Boolean; folders: TStringDynArray; i:Integer; begin folders := TDirectory.GetDirectories (s);
for i := 0 to length(folders)-1 do begin t:=s; s:=s+folders[i]+PathDelim; AddF; FindF; s:=t; end; end;
begin s:=TPath.GetDocumentsPath+PathDelim; AddF; FindF; s:=TPath.GetSharedDocumentsPath+PathDelim; AddF; FindF; end;
----------------------------------------------
http://mcool.appinn.me/
type TForm1 = class(TForm) MList: TListView; Scan: TButton; procedure ScanClick(Sender: TObject); private { Private declarations } public { Public declarations } end;
...
procedure TForm1.ScanClick(Sender: TObject); var s:String;
procedure AddF; var s1,s2:String; files : TStringDynArray; i:Integer; begin files := TDirectory.GetFiles (s);
for i := 0 to length(files)-1 do begin s1:=files[i]; s2:=ExtractFileExt(s1); if s2<>'' then s2:=s2+';'; if ContainsText('*.mp3;*.ape;*.tak;*.aac;*.flac;*.m4a;*.ogg;*.wav;',s2) then with MList.Items.Add do begin Text:=ExtractFileName(s1); Detail:=s1; end; end; end;
procedure FindF; var t:String; folders: TStringDynArray; i:Integer; begin folders := TDirectory.GetDirectories (s);
for i := 0 to length(folders)-1 do begin t:=s; s:=folders[i]+PathDelim; AddF; FindF; s:=t; end; end;
begin s:='/storage/'; AddF; FindF; if not DirectoryExists('/storage/sdcard/') then begin s:='/sdcard/'; AddF; FindF; end; end;