On Sun, 28 Dec 2003, baron kractor wrote:
> Wondering if anyone had done any work with manipulating id3 tag information > contained in mp3 / vorbis files from within fpc and could point me to some > documentation? This code reads the tag from an mp3 file: program showmp3; {$mode objfpc} {$h+} Uses Classes; Type TID3Tag = Packed Record TAG : Array[1..3] of char; Title : Array[1..30] of char; Artist : Array[1..30] of char; Album : Array[1..30] of char; Year : Array[1..4] of char; Comment : Array[1..30] of char; Genre : Byte; end; Procedure ShowInfo(Fn : String); Var Info : TID3Tag; begin With TFileStream.Create(FN,fmOpenRead) do try Seek(-(SizeOf(Info)),soFromEnd); Read(Info,SizeOf(Info)); With Info do begin Writeln('File : ',Fn); Writeln('Title : ',Title); Writeln('Artist : ',Artist); Writeln('Album : ',Album); Writeln('Year : ',Year); Writeln('Comment : ',Comment); Writeln('Genre : ',Genre); end; Finally Free; end; end; Var I : Integer; begin For I:=1 to ParamCount do ShowInfo(Paramstr(i)); end. Writing the tag can be done in the same manner. Somewhere on internet (DSP/Torry's delphi pages) there is a 'mpgtools' unit which can be compiled with FPC, it can also be used. I used to have it in compiled form, but I can't find it, only the program which I used to test : program showextmp3; {$mode objfpc} uses mpgtools,sysutils; begin With TMPEGAudio.Create do try FileName:=Paramstr(1); Writeln('Author',Artist); Writeln('Duration ',FormatDateTime('hh:nn:ss',DurationTime)); finally Free; end; end. This is all I can do, hopefully it is enough to get you started... Michael. _______________________________________________ fpc-pascal maillist - [EMAIL PROTECTED] http://lists.freepascal.org/mailman/listinfo/fpc-pascal