set publisher from composer or from extra publisher

Use this forum for everything concerning script usage
Post Reply
hopalongrock
Sr. Member
Sr. Member
Posts: 289
Joined: Wed Sep 15, 2010 1:38 pm

set publisher from composer or from extra publisher

Post by hopalongrock »

This script copies the composer field (set on grid and updated) to the publisher field. In a second run it fills the composer field from the publisher field to easily see the change.

I've put a little extension into it, because after I edit and export an mp3 with Audacity, the standard Publisher field is converted to a non standard Publisher user? field. In TGF I see it in "Tag - Edit - More Data - User & other fields" after the  PUBLISHER field name , instead of in Extended fields/Publisher field. Now the script handles this extra PUBLISHER field the same way as the composer field, moves it into the standard Publisher field, and deletes it.

It works well, but gTag.ExtraFieldsRemove; removes all extra fields - this is not problem now, because there is no other extra (user) fields.

But how could I remove only this extra PUBLISHER ?
-----------
Program copy_composer_to_publisher;
var
 sComposer: string;
begin
 if not tg_Init then exit;
 repeat
   tg_LoadFile;
   sComposer := trim(tg_getField('Composer'));
   if sComposer = '' then begin
      sComposer := trim(gTag.ExtraFieldGet('PUBLISHER'));
   end;
   if sComposer = '' then begin
      sComposer := gTag.publisher;
      tg_SetField('Composer',sComposer);
      continue;
   end;
   if length(sComposer)<1 then begin
      continue;
   end;
   tg_SetField('Composer','');
   gTag.publisher := sComposer;
   gTag.composer := '';
   gTag.ExtraFieldSet('PUBLISHER','');
   gTag.ExtraFieldsRemove;
   gTag.SaveToFile( 0, false, '', false);
 until not tg_Skip;
end.

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

Re: set publisher from composer or from extra publisher

Post by jtclipper »

I will add an ExtraFieldRemove function in the next beta release and also add a bit more functionality in the gTag variable regarding various unsupported fields.
Dimitris

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

Re: set publisher from composer or from extra publisher

Post by hopalongrock »

Great, many thanks.

Post Reply