Sunday, 29 November 2009

"Modifiers" in KRename

Andi Clemens did some amazing work on the batch renamer included and integrated into digiKam. I really like the simple UI and some of the features he included. I think I can get some inspiration from him for KRename (e.g. syntax highlighting).

Lately he posted over the topic of "Modifiers" in the digiKam rename tool, which he added to digiKams renamer and was not able to find in KRename. Modifiers are a way to convert a token, let's say the name of a directory or the artist of a mp3 in some way before inserting it. For example if you insert the name of the directory into the new filename and the directory name is in all uppercase and to match the look of the new filename, you want it to be inserted in lowercase. In digiKam's renamer it is achieved by the token:
[dir.]{lower}

In KRename you would use:
[%dirname.]

So contrary to Andi's post, KRename has modifiers, too. You can add a modifier before any token (after the opening bracket and before the actual name of the token). The modifierst are those used to insert filename's and convert there case. To list the most important ones:





$No conversion, insert the token as it is
%Convert to lowercase
&Convert to uppercase
*Convert every first letter in a word to uppercase
##Format a number with leading zeros


So you can even use modifierst to format numbers for tokens that return number. For example [##tagTrack] will insert the track number of a MP3 formatted with one leading zero if the track number is less than 10.

It is true that KRename does not have a really readable syntax for modifiers here, I think appending {upper} or {lower} like digiKam does it, is a good idea. But there are several other places, too, where the KRename syntax could be improved. I hope that this post will help a few people that also did not know about this feature.

Modifiers in action

7 comments:

Andi said...

Oh right, now I found it, too :-)
I didn't want to talk bad about KRename (if it sounded like that), I really thought it was not possible.
I use KRename for normal file renaming tasks, too, so it is good to know that I can use modifiers the next time ;-)

Andi

Dominik Seichter said...

Hi Andi,

No! I did not think you were talking bad about KRename. I just took your post as a chance to first blog again and secondly to show this feature of KRename which is really not widely known.

I really like your digiKam renaming integration. I am sure I can take a few ideas from you.

Best regards,
Dom

ArdellaJ said...

很喜歡你的部落格風格,期待你的更新!........................................

跌倒 said...

我對自己的信心已超越別人對我的評價........................................

My Family said...

Didier Drogba is adamant he wants to finish his career at Chelsea and says negotiations over mmtangkas a new contract at Stamford Bridge are ongoing.The Ivory Coast striker is in the final year ผลบอล of his contract in West London and the Blues are thought to have offered him a 12-month extension on his deal.

uknowme said...

I really like your digiKam renaming integration. I am sure I can take a few ideas from you.
new credit card

wenden

uknowme said...

No! I did not think you were talking bad about KRename. I just took your post as a chance to first blog again and secondly to show this feature of KRename which is really not widely known
glasses fashion

deler