Page 1 of 1

Customize Rename Special Capitalization or Templates

Posted: 14 Sep 2012 16:44
by drnunes
Hi,
I´d like to know if we can change the capitalization options at Rename Special menu.

I´m trying to speed the renaming of my mp3 files.
Usually I rename my files in this way:

ARTIST - Title.mp3

Artist´s name: all letters are in uppercase
Title: only the first letter is in uppercase
After Artist there is a space followed by "-" then another space then the title of the song
The extension is kept in lowercase

Is it possible to change the captalize options at Rename Special menu to AAA Aa.aaa or better AAA - Aa.aaa

I´ve tried batch rename but couldn´t find a way to do that and i don´t know to use RegExp or Script

Please, can anybody help me solving this problem.
Thanks

Re: Customize Rename Special Capitalization or Templates

Posted: 14 Sep 2012 20:16
by admin
RegExp. Somebody will provide something. <hope> :)

Re: Customize Rename Special Capitalization or Templates

Posted: 14 Sep 2012 21:53
by Marco
Select the songs you want to rename and run this (quickly tested)

Code: Select all

 foreach($item,<get selecteditemsnames>,<crlf>) {
  $artist = gettoken("$item",1," - ",,);
  $artist = recase($artist,"upper",);
  $title = gettoken("$item",2," - ",,);
  $title = recase($title,"sentence",1);
  renameitem($artist." - ".$title,$item,3,);
 };

Re: Customize Rename Special Capitalization or Templates

Posted: 14 Sep 2012 22:27
by Stefan
Very nice Marco. Half as long as my first try.

Here i have taken yours with an little error handling.

ARTIST - Title.mp3
Artist: all letters are in uppercase
Title: only the first letter is in uppercase
Extension: in lowercase

Code: Select all

  foreach($item,<get selecteditemsnames |>) {
    if(strpos($item, " - ")>0){
      $artist = recase(gettoken("$item",1," - "),"upper",);
      $title  = recase(gettoken("$item",2," - "),"sentence",1); 
      renameitem("$artist - $title",$item,3);
    }
  }


The RegEx engine don't provide \U \L \E and such syntax,
so it can't change the case like:
(.+?) - (.)(.+)(\.MP3) > $U1 - $U2$L3.$L4

Re: Customize Rename Special Capitalization or Templates

Posted: 19 Sep 2012 13:03
by drnunes
Thanks Marco and Stefan.

Both scripts helped me.