A command-line MP3 tag editor that reads and writes ID3v1 tags. Supports editing title, artist, album, year, comment, and genre fields. Includes text normalization features like capitalization, case conversion, and character replacement.
program mp3taged;
uses crt,dos;
const TagLen = 128;
NormRecLen = 30;
YearRecLen = 4;
GenreRecLen = 1;
TagHdr = #84#65#71;
TagHdrLen = 3;
Blank30 = ' ';
Blank = #32;
US = #95;
type TKeys = (Title,Artist,Album,Year,Comment,Genre,ReWrTag,Capit,
UnCapit,UpCase,LowCase,ReplUS,Normize);
TKeySet = array[TKeys] of string;
TStat = (Ok,IOEr,FEr,TEr,Brk,PEr,IEr);
TStatMsgs = array[TStat] of string;
TOptions = record
ReWrTag: boolean;
Capit: boolean;
UnCapit: boolean;
UpCase: boolean;
LowCase: boolean;
ReplUS: boolean;
Normize: boolean;
end;
TTag = record
Title, Artist, Album, Comment: array [1..NormRecLen] of char;
Year: array [1..YearRecLen] of char;
Genre: char;
end;
BigLet = set of 'A'..'Z';
SmaLet = set of 'a'..'z';
const KeySet: TKeySet = ('/t:','/a:','/b:','/y:','/c:','/g:','/r','/cp',
'/up','/u','/l','/r','/n');
StatMsg: TStatMsgs = (
'Tag successfully readed/created/modified.',
'Can''t threat tag: I/O error.',
'Warning! File is too small to be Mp3''s!',
'Can''t read tag: bad header.',
'User break.',
'Command line error',
'Internal error');
var Tag: TTag;
Options: TOptions;
F: file of char;
{$I MY\STRI.PAS}
{$I MY\FIO.PAS}
procedure Init
begin
Tag.Title:=Blank30
Tag.Artist:=Blank30
Tag.Album:=Blank30
Tag.Year:=' '
Tag.Genre:#255
Tag.Comment:Blank30
Options.ReWrTag:=False;
Options.Capit:=False;
Options.UnCapit:=False;
Options.UpCase:=False;
Options.LowCase:=False;
Options.ReplUS:=False;
Options.Normize:=False;
end;
begin
clrscr;
{case ReadTag(ParamStr(1)) of
IOEr: WriteLn(StatMsg[IOEr]);
TEr: WriteLn(StatMsg[TEr]);
Fer: WriteLn(StatMsg[FEr]);
Ok: begin
WriteLn(StatMsg[ReadParam]);
Match;}
case WriteTag('conver~1.mp3') of
IOEr: WriteLn(StatMsg[IOEr]);
TEr: WriteLn(StatMsg[TEr]);
FEr: WriteLn(StatMsg[FEr]);
Ok: WriteLn(StatMsg[Ok]);
end;
{end;}
{end;}
with Tag do
begin
WriteLn('"',Title,'"');
WriteLn('"',Artist,'"');
WriteLn('"',Album,'"');
WriteLn('"',Year,'"');
WriteLn('"',Comment,'"');
WriteLn('"',Genre,'"');
end;
repeat until KeyPressed;
end.