Page 1 of 1

Manual, AMG composer, Search and Replace Tag

Posted: Mon Mar 21, 2011 10:53 pm
by Mus
Hi y'all,

Have I missed something obvious or is there a Help Manual with what looks to be a great program?

Also is it possible to batch scan and remove text within the Album tag (I embedded the year in brackets and want to remove e.g. "Help! (1965)")

And, is it possible to try and batch update the Composer tag from AMG?

Many thanks

M

Re: Manual, AMG composer, Search and Replace Tag

Posted: Tue Mar 22, 2011 10:47 am
by jtclipper
There is a help file you can use F1 to display it.

Yes you can remove the text you want in the album field using a modified script of the build in regex example

Code: Select all

program regex;

var
  sTmp: string;
  bUpdated: boolean;

begin

  if not tg_Init then exit; // no rows get out

  repeat

    bUpdated := false;

    sTmp := tg_GetField( 'Album' );

    if sys_RegexFind( sTmp, '(\(\d{1,4}\))' ) then begin
       tg_setField( 'Album', sys_RegexReplace( sTmp, '(\(\d{1,4}\))', [1,''] ) );
       bUpdated := true;
    end;

    if bUpdated then begin
       tg_setSkip( false );
       tg_SetResult( 'OK' );
    end else begin
       tg_setSkip( true );
    end;

  until not tg_Skip;

end.
This will remove the year from the album field and mark as skip any files that are not affected.

You can update the composer field per album but not for your entire collection.

Re: Manual, AMG composer, Search and Replace Tag

Posted: Tue Mar 22, 2011 7:38 pm
by Mus
That's great! Many thanks for the reply and excellent support.

Would it then be possible to populate the Year tag with the contents of the year between the Album brackets before removing the latter?

Regards
M

Re: Manual, AMG composer, Search and Replace Tag

Posted: Wed Mar 23, 2011 12:48 pm
by jtclipper
You can use this to have the year field updated also.

Code: Select all

program regex;

var
  sTmp, sTmp1: string;
  bUpdated: boolean;

begin

  if not tg_Init then exit; // no rows get out

  repeat

    bUpdated := false;

    sTmp := tg_GetField( 'Album' );

    if sys_RegexFind( sTmp, '(\(\d{1,4}\))' ) then begin
       tg_setField( 'Album', sys_RegexReplace( sTmp, '(\(\d{1,4}\))', [1,''] ) );
       sTmp1 := sys_RegexFindStr( sTmp, '(\(\d{1,4}\))', 1 );
       sTmp1 := AnsiReplaceText( sTmp1, '(',  '' );
       sTmp1 := AnsiReplaceText( sTmp1, ')',  '' );
       tg_setField( 'Year' , sTmp1 );
       bUpdated := true;
    end;

    if bUpdated then begin
       tg_setSkip( false );
       tg_SetResult( 'OK' );
    end else begin
       tg_setSkip( true );
    end;

  until not tg_Skip;

end.
Remember to click the update button to have the values saved to the files after you isnpect the results.

Re: Manual, AMG composer, Search and Replace Tag

Posted: Wed Mar 23, 2011 7:59 pm
by Mus
Thank you very much  ;D