This is my masstagger renaming script, operating on variables before renaming:
$num(%tracknumber%,2)- $trim($replace($replace(
$if($stricmp($left(%artist%,4),The ),$substr(%artist%,5,60),
$if($stricmp($left(%artist%,2),A ),$substr(%artist%,3,60),%artist%)),
$char(92), ,$char(47), ,'|',,<,,>,,'"',,*,,?,,:,, - , , -, ,- , ,'(',,')',,ß,ss,œ,
oe,æ,ae,',',,!,,$char(39),,.,,_, ,&,And,+,Plus,å,a,Å,A,ä,a,Ä,A,ö,o,Ö,O,
ø,o,ô,o,ò,o,ó,o,à,a,À,A,Â,A,Á,A,á,a,ë,e,é,e,É,E,ê,e,Ê,E,è,e,È,E,î,i,Î,I,
Ç,C,ç,c,ì,i,í,i,ñ,n,Ü,U,ü,u,ú,u,ù,u), , , , , , )) - $trim(
$replace($replace($if($stricmp($left(%title%,4),The ),
$substr(%title%,5,60),$if($stricmp($left(%title%,2),A ),
$substr(%title%,3,60),%title%)),$char(92), ,$char(47), ,'|',,<,,>,,'"',,
*,,?,,:,, - , , -, ,- , ,'(',,')',,ß,ss,œ,oe,æ,ae,',',,!,,$char(39),,.,,_, ,&,And,
+,Plus,å,a,Å,A,ä,a,Ä,A,ö,o,Ö,O,ø,o,ô,o,ò,o,ó,o,à,a,À,A,Â,A,Á,A,á,a,ë,e,
é,e,É,E,ê,e,Ê,E,è,e,È,E,î,i,Î,I,Ç,C,ç,c,ì,i,í,i,ñ,n,Ü,U,ü,u,ú,u,ù,u), , , , , , ))
It is an adaption of these perl-regexps, which operated directly on the filenames:
s/\&/ And /g;
y/åÅäÄöÖøôòóàÀÂÁáëéÉêÊèÈîÎÇçìíñÜüúù/aAaAoOooooaAAAaeeEeEeEiICciinUuuu/;
s/\((.+?)\)/\L$1\E/g; # ()
s/ß/ss/g;s/œ/oe/g;s/æ/ae/g;s/,|!|\'//g;s/\. |\_/ /g;
s/\.(?=.*\..+)//g; # Remove dots
s/- The |- A /- /g; s/^The //;
s/(?<![\d ])- / /g;
s/ +/ /g; # Reduce multiple spaces
s/ (?=\..+$)//g; # Remove last space
This metadata:
Artist: The Baguettes
Title: A Trip To Heaven (Ça Sonne Bien) (Acoustic)
Tracknumber: 3
will result in this filename:
03- Baguettes - Trip To Heaven ca sonne bien acoustic.mp3
The fb2k code is not optimised, and sometimes even redundant, but I hope this will inspire someone. If there is a good way to lowercase the content of parentheses, please contribute.
[span style='font-size:8pt;line-height:100%']Edit: The renaming script contained bugs. They are fixed and the code above is updated.[/span]