Customize Rename Special Capitalization or Templates

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
Post Reply
drnunes
Posts: 2
Joined: 14 Sep 2012 16:19

Customize Rename Special Capitalization or Templates

Post 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

admin
Site Admin
Posts: 67269
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: Customize Rename Special Capitalization or Templates

Post by admin »

RegExp. Somebody will provide something. <hope> :)

Marco
Posts: 2354
Joined: 27 Jun 2011 15:20

Re: Customize Rename Special Capitalization or Templates

Post 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,);
 };
Tag Backup - SimpleUpdater - XYplorer Messenger - The Unofficial XYplorer Archive - Everything in XYplorer
Don sees all [cit. from viewtopic.php?p=124094#p124094]

Stefan
Posts: 1360
Joined: 18 Nov 2008 21:47
Location: Europe

Re: Customize Rename Special Capitalization or Templates

Post 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

drnunes
Posts: 2
Joined: 14 Sep 2012 16:19

Re: Customize Rename Special Capitalization or Templates

Post by drnunes »

Thanks Marco and Stefan.

Both scripts helped me.

Post Reply