Page 1 of 1

Restructure by artist without "featuring"

Posted: Mon Oct 29, 2012 2:52 pm
by Eagle
Hi.

Great program at first. I used it a lot in the last days to rename all my mp3s and to get a sensible naming structure.
Now that I updated all the ID3 tags I thought about changing the way I structure the files and played around with the build-in options. I would prefer if my folders were structured as !%A|%L which in the beginning was easy to achieve. Eventually though it happened that I got albums distributed over several "authors" as there are those authors like e.g. Artist | Artist feat. xyz | Artist Feat. zyx | Artist vs. abc | Artist & cba.

I guess this could be solved by a script but:
I don't have a clue how to program a script that scans the artist string until it finds a regular expression (feat./ft./vs./& - case insensitive) and only does the level 2 structure according to the prior part of the string. Also, if no album was found, the files are supposed to be put directly in level 1 under %A.

Could someone help me or give me a hint to how I can parse a string and find the regular expression with the scripts?

Re: Restructure by artist without "featuring"

Posted: Mon Oct 29, 2012 4:48 pm
by jtclipper
Try the following, its a simple modification of the #simple.scu script

Code: Select all

{!%A|%L}
program artist_album_feat;
var
  sTmp: string;
  iPos: integer;
begin
  re_Init( false );

  repeat
     sTmp := re_getLevel( 1 );
     iPos := Pos( 'vs.', LowerCase( sTmp ) );
     if iPos = 0 then iPos := Pos( 'feat', LowerCase( sTmp ) );
     if iPos = 0 then iPos := Pos( 'feat.', LowerCase( sTmp ) );
     if iPos > 0 then re_setLevel( 1, Copy( sTmp, 1, iPos - 1 ) );

     sTmp := re_getLevel( 2 );
     if Trim( sTmp ) = '' then re_removeLevel( 2 );
  until not re_Skip;
end.
Also please uncheck the 'correct illegal chars' option it seems to interfere with the '.' in the end of some tags

Re: Restructure by artist without "featuring"

Posted: Wed Oct 31, 2012 11:55 am
by Eagle
Thank you for the help. The script works just perfect. I had to remove ":" from the album titles though, I think that's because I unchecked the 'correct illegal characters' option.

I guess the first if - according the "feat" string would also find "feat.", so I substituted the second if by "ft." and also did an additional check like in the advanced example so it would copy all files without a known artist (artist tag == '') to a various artist folder.

Thanks again.