INTERACT FORUM

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1]   Go Down

Author Topic: Renaming files using functions  (Read 1370 times)

ChrisRainman

  • Regular Member
  • Galactic Citizen
  • ****
  • Posts: 306
  • nothing more to say...
Renaming files using functions
« on: January 15, 2009, 02:51:43 pm »

I sort my music file library with the rename files option in MC13.

Files with an entry in the tag field "album" are stored in the folder "albums", files without that entry are in "Single tracks".

This used to work for a while with using the function IF(ISEMPTY([Album]) which is much easier to handle. Unfortunately, in recent builds it looks like I need to use the old statement.

In earlier days it was necessary to use the function ISEQUAL([Album],Unknown Album) which has some disadvantages:
For every language you need another statement. As I sometimes switch between german and english I didn't like this behaviour. Also, you always need to change the statement depending on the field, e.g. for genre "unknown genre", ...

Is there another (easier) way to check empty fields in an if-statement?
Logged

marko

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 9143
Re: Renaming files using functions
« Reply #1 on: January 16, 2009, 05:54:15 am »

if(isequal([Field],unknown,8),

The rename from properties tool does it this way in order to prevent problems caused by illegal windows folder names. "isempty" will work within the safe confines of the MC library, but upon export via the rename tool, empty data is replaced with "unknown Field"

-marko.

ChrisRainman

  • Regular Member
  • Galactic Citizen
  • ****
  • Posts: 306
  • nothing more to say...
Re: Renaming files using functions
« Reply #2 on: January 16, 2009, 09:04:04 am »

To be honest, I don't exactly understand what you're telling me and how this can cause such problems with windows folder names.

Basically, I think it is acceptable to use ISEQUAL instead. Up to now, I was not aware what "8" means. In earlier versions the parameters only were defined up to 6. So, the substring search allows me not to add the field name. Anyway, if you change the language, you need to adjust your rules. I wished, this could be in english only...

Thanks.
Logged

marko

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 9143
Re: Renaming files using functions
« Reply #3 on: January 16, 2009, 01:31:01 pm »

If you asked MC to create a file path using [genre]\[artist]\[album] and artist is an empty field, what should happen?
"Rock\\Rock Album" is an illegal file path. MC does not worry the user about such things, instead, it substitutes "unknown field" for empty fields thus avoiding the pitfall.

two new isequal parameters were added... seven and eight.
Seven performs a case-sensitive substring compare and eight performs a case insensitive substring compare. (ie: [field] contains string)
"8" can be a real time saver :)

-marko.

ChrisRainman

  • Regular Member
  • Galactic Citizen
  • ****
  • Posts: 306
  • nothing more to say...
Re: Renaming files using functions
« Reply #4 on: January 18, 2009, 03:52:34 pm »

It's true - the way MC behaves in case of missing fields is not the worst! First, I thought that it might be possible that the function ISEMPTY can be processed before the replacement of the missing field with the string "unknown field". But, obviously, this is not the case. So ISEQUAL is fine - yes, with parameter 8 it's really easier.

The only thing is the translation issue. Wouldn't it make sense, that such keywords set by MC are never translated, so that I can use the defined smartlist rules in any language? I mean that "unknown" remains "unknown" independent of the language MC runs with.
Logged
Pages: [1]   Go Up