Manual, AMG composer, Search and Replace Tag

Main discussion forum
Post Reply
Mus
Newbie
Newbie
Posts: 5
Joined: Mon Mar 21, 2011 10:41 pm

Manual, AMG composer, Search and Replace Tag

Post 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

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

Re: Manual, AMG composer, Search and Replace Tag

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

Mus
Newbie
Newbie
Posts: 5
Joined: Mon Mar 21, 2011 10:41 pm

Re: Manual, AMG composer, Search and Replace Tag

Post 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

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

Re: Manual, AMG composer, Search and Replace Tag

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

Mus
Newbie
Newbie
Posts: 5
Joined: Mon Mar 21, 2011 10:41 pm

Re: Manual, AMG composer, Search and Replace Tag

Post by Mus »

Thank you very much  ;D

Post Reply