Page 1 of 1
Remove tags
Posted: Tue Oct 26, 2010 4:22 am
by atagal
How to remove tags from files (online)?
There are 3 procedures:
procedure Reset( const bFieldsOnly: boolean );
procedure ExtraFieldsRemove;
procedure ResetData;
first 2 absloutely useless and wont work.
Code: Select all
on_LoadFile;
gTag.Reset (true);
gTag.SaveToFile( 0, false, '', false);
Code: Select all
on_LoadFile;
gTag.ExtraFieldsRemove;
gTag.SaveToFile( 0, false, '', false);
ResetData work but badly do damage to VBR header
for example if files are LAME -V2, after gTag.ResetData TGF show incorrect duration, bitrate or wrong codec (xing)..
Code: Select all
on_LoadFile;
gTag.ResetData;
gTag.SaveToFile( 0, false, '', false);
maybe i do something wrong?
ps. how to disable log popup?
Re: Remove tags
Posted: Tue Oct 26, 2010 8:06 am
by jtclipper
To remove tags you can try the following
Code: Select all
Program Test;
var
i, iCount: integer;
begin
iCount := on_getGrdRowCount;
if iCount = 0 then exit;
for i := 1 to iCount do begin
on_setGrdRow(i);
on_LoadFile;
gTag.RemoveFromFile( 0 ); // remove all tags
end;
end.
If you have trouble with the VBR header I would like to check one of those files so please mail it to me.
Re: Remove tags
Posted: Tue Oct 26, 2010 8:57 am
by atagal
gTag.RemoveFromFile( 0 );
also wont work!
Code: Select all
for i := 1 to on_getGrdRowCount do
begin
on_setGrdRow( i );
on_LoadFile;
gTag.RemoveFromFile( 0 );
gTag.ExtraFieldSet( 'CATALOG', sCatalog ) ;
gTag.ExtraFieldSet( 'COUNTRY', sCountry ) ;
gTag.ExtraFieldSet( 'FORMAT', on_getType ) ;
gTag.ExtraFieldSet( 'PUBLISHER', on_getLabel ) ;
gTag.SaveToFile( 0, false, '', false);
...
Re: Remove tags
Posted: Tue Oct 26, 2010 9:08 am
by jtclipper
Try this one
Code: Select all
Program Test;
var
i, iCount: integer;
begin
iCount := on_getGrdRowCount;
if iCount = 0 then exit;
for i := 1 to iCount do begin
on_setGrdRow(i);
on_LoadFile;
gTag.RemoveFromFile( 0 );
gTag.Reset( true ); // <- clear in memory fields also
gTag.ExtraFieldSet( 'CATALOG', '1' ) ;
gTag.ExtraFieldSet( 'COUNTRY', '2' ) ;
gTag.ExtraFieldSet( 'FORMAT', '3' ) ;
gTag.ExtraFieldSet( 'PUBLISHER', '4' ) ;
gTag.SaveToFile( 0, false, '', false);
end;
end.
Re: Remove tags
Posted: Tue Oct 26, 2010 9:20 am
by atagal
tags left the same... but VBR header was damaged.
dont work

Re: Remove tags
Posted: Tue Oct 26, 2010 9:22 am
by jtclipper
mail me your script and a file to test please.
Re: Remove tags
Posted: Tue Oct 26, 2010 11:30 pm
by atagal
was sent yesterday. any suggestions?
my script is messy because i dont know delphi but thanks to tgf i know basics now

btw resetdata works like charm with flac files!
Re: Remove tags
Posted: Wed Oct 27, 2010 9:39 am
by jtclipper
I took a look at your script and I isolated the code that seems to be problematic.
Code: Select all
program test;
var
i: integer;
sExt, sTrack, sTitle, sComposer, sTime: string;
fDur: extended;
begin
for i := 1 to on_getGrdRowCount do begin
on_setGrdRow( i );
on_LoadFile;
gTag.RemoveFromFile( 0 );
on_LoadFile;
gTag.ExtraFieldSet( 'CATALOG' , '1' );
gTag.ExtraFieldSet( 'COUNTRY' , '2' );
gTag.ExtraFieldSet( 'FORMAT' , '3' );
gTag.ExtraFieldSet( 'PUBLISHER', '4' );
on_UpdateThis( false ); // <-update row
on_getTrack( i, sTrack, sTitle, sComposer, sTime, fDur );
sExt := gTag.FileExt;
sTrack := PadLeft( Trim( sTrack ), 2, '0' )
on_setGrdField( 'Rename', sTrack + '. ' + sys_RemoveIllegalChars(sTitle) + '.' + sExt);
on_RenameThis; // <-rename row
end;
end.
This is what I used and it works ok, it removes the tag from the file, reloads adds users fields to it then updates using current grid/album info values just like the "Update This" pop menu command, this way each file is updated and renamed inside the for loop.
I have sen that you used On_apply,on_rename,on_update at a later stage please dont use those just rely on the above example to update/rename the files per row.
I did not have any problems with the VBR header , the only problem is that if you remove the tag replay gain info will be lost.
Re: Remove tags
Posted: Wed Oct 27, 2010 12:18 pm
by atagal
thank you!
PadLeft( Trim( sTrack ), 2, '0' ) was very good hint!
ive added On_apply yet, because wont update,only rename files.