Einzelnen Beitrag anzeigen

Nils_13

Registriert seit: 15. Nov 2004
2.647 Beiträge
 
#88

Re: Dark Player 1.8 (dAmp)

  Alt 26. Okt 2005, 08:39
Zitat von TeronG:
Zitat von Nils_13:
Hi,

hier mein Update auf 1.8
- Laut Credis's: "Dark Player 1.7"
- Gaaanz oben wo der Filename steht hab ich nen kleinen weißen punkt (1 -2 pixel breit oder so ^^)
- "Visualisierung AN/AUS" könntest du evtl. noch nen Hacken verpassen...
- Zu Unterordner durchsuchen: FindAllFiles hier in der DP!
Nächstes update kommt gleich, wenn das Problem mit FindAllFiles gelöst ist:
Delphi-Quellcode:
procedure pform.InitFindAllFiles;
begin
  SetLength(FoundFiles, 0);
  cntFoundFiles := 0;
end;

procedure pform.FindAllFiles(RootFolder: string; Mask: string; Recurse: Boolean =
  True);
var
  hFindFile : THandle;
  wfd : TWin32FindData;
  Filename : string;
begin
  if RootFolder[length(RootFolder)] <> '\then
    RootFolder := RootFolder + '\';
  ZeroMemory(@wfd, sizeof(wfd));
  wfd.dwFileAttributes := FILE_ATTRIBUTE_NORMAL;
  if Recurse then
  begin
    hFindFile := FindFirstFile(pointer(RootFolder + '*.*'), wfd);
    if hFindFile <> 0 then
    try
      repeat
        if wfd.dwFileAttributes and FILE_ATTRIBUTE_DIRECTORY =
          FILE_ATTRIBUTE_DIRECTORY then
          if (string(wfd.cFileName) <> '.') and (string(wfd.cFileName) <> '..')
            then
          begin
            FindAllFiles(RootFolder + wfd.cFileName, Mask, Recurse);
          end;
      until FindNextFile(hFindFile, wfd) = False;
    finally
      Windows.FindClose(hFindFile);
    end;
  end;
  hFindFile := FindFirstFile(pointer(RootFolder + Mask), wfd);
  if hFindFile <> INVALID_HANDLE_VALUE then
  try
    repeat
      if wfd.dwFileAttributes and FILE_ATTRIBUTE_DIRECTORY <>
        FILE_ATTRIBUTE_DIRECTORY then
      begin
        Filename := RootFolder + string(wfd.cFileName);
        if length(FoundFiles) = cntFoundFiles then
          SetLength(FoundFiles, length(FoundFiles) + 100);
        FoundFiles[cntFoundFiles] := Filename;
        Inc(cntFoundFiles);
      end;
    until FindNextFile(hFindFile, wfd) = False;
  finally
    Windows.FindClose(hFindFile);
    setlength(FoundFiles, cntFoundFiles);
  end;
end;
Delphi-Quellcode:
procedure Tpform.plist_overClick(Sender: TObject);
var mp3Folder, files : string;
begin

 mp3Folder := BrowseDialog('Choose a folder with mp3 files', BIF_RETURNONLYFSDIRS);
 if mp3Folder = 'then Exit;

 txtFolder.Caption := mp3Folder;

 files := StrToFloat(InitFindAllFiles);
// files := FindAllFiles(mp3folder);

 //fill the list box with mp3 files
 FillMP3FileList(files{mp3Folder}, mp3List.Items);
end;
Hier müssen die ausgewählten Ordner rein, aber wie mach ich das ?
FillMP3FileList(files{mp3Folder}, mp3List.Items);
Delphi-Quellcode:
procedure Tpform.FillID3TagInformation(mp3File:string; Title,Artist,Album,Year,Genre,Comment:TEdit);
var //fMP3: file of Byte;
    ID3 : TID3Rec;
    fmp3: TFileStream;
begin
  fmp3:=TFileStream.Create(mp3File, fmOpenRead);
  try
    fmp3.position:=fmp3.size-128;
    fmp3.Read(ID3,SizeOf(ID3));
  finally
    fmp3.free;
  end;

 { or the non Stream approach - as in ChangeID3Tag procedure
try
  AssignFile(fMP3, mp3File);
  Reset(fMP3);
  try
    Seek(fMP3, FileSize(fMP3) - 128);
    BlockRead(fMP3, ID3, SizeOf(ID3));
  finally
  end;
finally
  CloseFile(fMP3);
end;
}

 if ID3.Tag <> 'TAGthen begin
   Title.Text:='Wrong or no ID3 tag information';
   Artist.Text:='Wrong or no ID3 tag information';
   Album.Text:='Wrong or no ID3 tag information';
   Year.Text:='Wrong or no ID3 tag information';
   Genre.Text:='Wrong or no ID3 tag information';
   Comment.Text:='Wrong or no ID3 tag information';
 end else begin
   Title.Text:=ID3.Title;
   Artist.Text:=ID3.Artist;
   Album.Text:=ID3.Album;
   Year.Text:=ID3.Year;
   if ID3.Genre in [0..MaxID3Genre] then
     Genre.Text:=ID3Genre[ID3.Genre]
   else
     Genre.Text:=IntToStr(ID3.Genre);
   Comment.Text:=ID3.Comment
 end;
end;

procedure Tpform.FillMP3FileList(Folder: string; sl: TStrings);
var Rec : TSearchRec;
begin
 sl.Clear;
 if SysUtils.FindFirst(Folder + '*.mp3', faAnyFile, Rec) = 0 then
  try
    repeat
      sl.Add(Rec.Name);
    until SysUtils.FindNext(Rec) <> 0;
  finally
    SysUtils.FindClose(Rec);
  end;
end;

function Tpform.BrowseDialog(const Title: string; const Flag: integer): string;
var
  lpItemID : PItemIDList;
  BrowseInfo : TBrowseInfo;
  DisplayName : array[0..MAX_PATH] of char;
  TempPath : array[0..MAX_PATH] of char;
begin
  Result:='';
  FillChar(BrowseInfo, sizeof(TBrowseInfo), #0);
  with BrowseInfo do begin
    hwndOwner := Application.Handle;
    pszDisplayName := @DisplayName;
    lpszTitle := PChar(Title);
    ulFlags := Flag;
  end;
  lpItemID := SHBrowseForFolder(BrowseInfo);
  if lpItemId <> nil then begin
    SHGetPathFromIDList(lpItemID, TempPath);
    Result := IncludeTrailingBackslash(TempPath);
    GlobalFreePtr(lpItemID);
  end;
end;
Der weiße Punkt soll eigentlich einen - darstellen, aber delphi kriegts nicht hin. Warum der Bindestrich da ist könnt ihr hier lesen:
http://www.delphi-forum.de/viewtopic...=304683#304683
Ich hab das noch nicht gelöst, ich wäre euch für jede Hilfe dankbar.
  Mit Zitat antworten Zitat