Changeset 3


Ignore:
Timestamp:
Feb 17, 2014, 4:15:32 PM (10 years ago)
Author:
chronos
Message:
  • Podpora pro více přípon souborů.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GenPlaylist.pas

    r2 r3  
    44  SysUtils;
    55 
    6 procedure FileSearch(const PathName, FileName, BasePath : string) ;
     6type
     7  TStringArray = array of string;
     8 
     9function InStrArray(Value: string; StrArray: array of string): Boolean;
     10var
     11  I: Integer;
     12begin
     13  I := 0;
     14  while (I < Length(StrArray)) and (StrArray[I] <> Value) do Inc(I);
     15  if I < Length(StrArray) then Result := True
     16    else Result := False;
     17end;
     18 
     19procedure FileSearch(const PathName: string; ExtList: array of string; BasePath : string) ;
    720var
    821  Rec: TSearchRec;
     
    1831      if Rec.Name = '..' then continue
    1932      else if Rec.Name = '.' then continue
    20       else if (Rec.Attr and faDirectory) > 0 then FileSearch(Path + Rec.Name, FileName, BasePAth)
    21       else if LowerCase(ExtractFileExt(Rec.Name)) = LowerCase(FileName) then begin
     33      else if (Rec.Attr and faDirectory) > 0 then FileSearch(Path + Rec.Name, ExtList, BasePAth)
     34      else if InStrArray(LowerCase(ExtractFileExt(Rec.Name)), ExtList) then begin
    2235        //WriteLn('File: ' + Rec.Name);
    2336        ItemFileName := ParamStr(2) + Copy(Path + Rec.Name, Length(BasePath) + 2, High(Integer));
     
    3346begin
    3447  WriteLn('#EXTM3U');
    35   FileSearch(ParamStr(1), '.mp3', ParamStr(1));
     48  FileSearch(ParamStr(1), ['.mp3', '.ac3', '.flac', '.it', '.m4a', '.wma', '.s3m', '.ogg'], ParamStr(1));
    3649end.
Note: See TracChangeset for help on using the changeset viewer.