Remove tags

Use this forum for everything concerning script usage
Post Reply
atagal
Newbie
Newbie
Posts: 34
Joined: Tue Oct 26, 2010 12:08 am

Remove tags

Post 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);
Image

maybe i do something wrong?

ps. how to disable log popup?

User avatar
jtclipper
Administrator
Administrator
Posts: 770
Joined: Tue Aug 10, 2010 12:04 pm

Re: Remove tags

Post 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.
Dimitris

atagal
Newbie
Newbie
Posts: 34
Joined: Tue Oct 26, 2010 12:08 am

Re: Remove tags

Post 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);
        ...

User avatar
jtclipper
Administrator
Administrator
Posts: 770
Joined: Tue Aug 10, 2010 12:04 pm

Re: Remove tags

Post 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.
Dimitris

atagal
Newbie
Newbie
Posts: 34
Joined: Tue Oct 26, 2010 12:08 am

Re: Remove tags

Post by atagal »

tags left the same...  but VBR header was damaged.
dont work  :-\

User avatar
jtclipper
Administrator
Administrator
Posts: 770
Joined: Tue Aug 10, 2010 12:04 pm

Re: Remove tags

Post by jtclipper »

mail me your script and a file to test please.
Dimitris

atagal
Newbie
Newbie
Posts: 34
Joined: Tue Oct 26, 2010 12:08 am

Re: Remove tags

Post 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!
Last edited by atagal on Tue Oct 26, 2010 11:36 pm, edited 1 time in total.

User avatar
jtclipper
Administrator
Administrator
Posts: 770
Joined: Tue Aug 10, 2010 12:04 pm

Re: Remove tags

Post 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.
Dimitris

atagal
Newbie
Newbie
Posts: 34
Joined: Tue Oct 26, 2010 12:08 am

Re: Remove tags

Post by atagal »

thank you!

PadLeft( Trim( sTrack ), 2, '0' ) was very good hint! :)

ive added On_apply yet, because wont update,only rename files.
Last edited by atagal on Wed Oct 27, 2010 1:01 pm, edited 1 time in total.

Post Reply