function readID3Tag(FileName: string): TID3Tag; var FS: TFileStream;
Buffer: array [1..128] of Char; begin FS := TFileStream.Create(FileName, fmOpenRead or fmShareDenyWrite); try FS.Seek(-128, soFromEnd);
FS.Read(Buffer, 128); with Result do
begin ID := Copy(Buffer, 1, 3);
Titel := Copy(Buffer, 4, 30);
Artist := Copy(Buffer, 34, 30);
Album := Copy(Buffer, 64, 30);
Year := Copy(Buffer, 94, 4);
Comment := Copy(Buffer, 98, 30);
Genre := Ord(Buffer[128]); end; finally FS.Free; end; end;
procedure TfrmMain.Button1Click(Sender: TObject); begin
if OpenDialog1.Execute then
begin
with readID3Tag(OpenDialog1.FileName) do
begin LlbID.Caption := 'ID: ' + ID;
LlbTitel.Caption := 'Titel: ' + Titel;
LlbArtist.Caption := 'Artist: ' + Artist;
LlbAlbum.Caption := 'Album: ' + Album;
LlbYear.Caption := 'Year: ' + Year;
LlbComment.Caption := 'Comment: ' + Comment; if (Genre >= 0) and (Genre <=146) then LlbGenre.Caption := 'Genre: ' + Genres[Genre] else LlbGenre.Caption := 'N/A'; end; end; end;