Create options to delete tags like in the Tools menu

Main discussion forum
Post Reply
hopalongrock
Sr. Member
Sr. Member
Posts: 290
Joined: Wed Sep 15, 2010 1:38 pm

Create options to delete tags like in the Tools menu

Post by hopalongrock »

I use only mp3 with Id3v2 tag, and always delete lyrics and ape tags in tools.
Maybe TGF could do this automatically, with the help of some new settings in Options / Tags? to retain or clear these other tag types, pictures.
For example I would enable the delete lyrics and delete ape settings, and disable the picture delete setting, because I would delete the pictures from Tools, if I don't need them, rather then always change it's enable/disable setting in the options.

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

Re: Create options to delete tags like in the Tools menu

Post by jtclipper »

There is an option to remove ID3v1 upon save but not ape which has to be done manually for the time being.

hopalongrock
Sr. Member
Sr. Member
Posts: 290
Joined: Wed Sep 15, 2010 1:38 pm

Re: Create options to delete tags like in the Tools menu

Post by hopalongrock »

jtclipper wrote:There is an option to remove ID3v1 upon save but not ape which has to be done manually for the time being.
Yes, ID3v1 is no problem, I hope you will accomplish the optional/ automatic deletions in the future.

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

Re: Create options to delete tags like in the Tools menu

Post by jtclipper »

For now you can rely on scripts, for example the following can do what you described (test it first)
If you like you can un-comment the lyrics or pictures lines to delete those also.

Code: Select all

Program UpdateEX;

var
  i: integer;
begin

  if not tg_init then exit;

  i := 1;
  sys_SetStatusText( 2, IntToStr( tg_GetRowCount ) );

  repeat
    tg_loadFile;

    sys_SetStatusText( 1, IntToStr( i ) );
    sys_SetStatusText( 3, gTag.Filename );

    //gTag.Lyrics := '';
    //gTag.ClearPictures;

    gTag.SavetoFile( 0, false, false );

    gTag.RemoveFromFile( 4, true, false ); //4=ape, true=force remove, false=do not refresh grid row

    i := i + 1;
  until not tg_skip;

end. 

hopalongrock
Sr. Member
Sr. Member
Posts: 290
Joined: Wed Sep 15, 2010 1:38 pm

Re: Create options to delete tags like in the Tools menu

Post by hopalongrock »

Now I tried gTag.ClearPictures, it works well, but doesn't reset id3v2 padding. From tools / Sync the padding reset works well.

According to the help, if the 3rd parameter of SaveToFile is true, TGF resets the id3v2 padding, but the file size isn't not reduced.
{function SaveToFile( const iFlg: integer = 0; bBasicOnly: boolean = false; bResetPadding: boolean = false ): Boolean;}

Program PictureTORLES;
begin
if not tg_init then exit;
repeat
tg_loadFile;
gTag.ClearPictures;
gTag.SaveToFile( 0, false, true); // true: ResetPadding
until not tg_skip;
end.

I couldn't find other references of reset padding in scripts.

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

Re: Create options to delete tags like in the Tools menu

Post by jtclipper »

The 3rd parameter resets padding if set to true, the same method is used internally when you interact with the UI (tools/..).
It should change the file size if conditions are met , if not then there might be a bug in general.

hopalongrock
Sr. Member
Sr. Member
Posts: 290
Joined: Wed Sep 15, 2010 1:38 pm

Re: Create options to delete tags like in the Tools menu

Post by hopalongrock »

jtclipper wrote:The 3rd parameter resets padding if set to true, the same method is used internally when you interact with the UI (tools/..).
It should change the file size if conditions are met , if not then there might be a bug in general.
I tried two times, with one-one mp3 containing one jpg - the above script(true the 3rd param) clears the picture, but doesn't reset padding, a subsequent tools/sync/reset shrinks the file
Please examine the problem/script in my previous script.

I tried in 0.81 and 0.71 beta2 too, with the same result (I inserted a '' as 3rd parameter before the now 4th True param) in savetofile.

hopalongrock
Sr. Member
Sr. Member
Posts: 290
Joined: Wed Sep 15, 2010 1:38 pm

Re: Create options to delete tags like in the Tools menu

Post by hopalongrock »

OK, I found in the help of the previous versions, that in the savetofile there is no "reset padding" parameter.

Post Reply