set publisher from composer or from extra publisher
Posted: Sun May 08, 2011 10:37 am
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.
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.