INTERACT FORUM

Please login or register.

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

Author Topic: Please help with renaming rule expression!!  (Read 1352 times)

latebeat

  • Recent member
  • *
  • Posts: 16
Please help with renaming rule expression!!
« on: November 06, 2010, 01:37:24 pm »

Hello all,

I'm trying to syntax a renaming rule for my files so that single artist albums go under \Artists\ and V.A. albums go under \Compilations\

This is what I'm doing but it doesnt seem to work:
Code: [Select]
If(IsEmpty([Album Artist]),Artists\,Compilations\)
I've created a new library field (Expression Test) to test the output of my expression. So in that field the expression seems to work as shown in the screenshot. However when used in the renaming dialog it doesn't work.



 Any ideas?

Logged

marko

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 8972
Re: Please help with renaming rule expression!!
« Reply #1 on: November 06, 2010, 03:40:06 pm »

Evening latebeat,

Read the wiki ;)

The following quote should clear up your question:
Quote
if(isempty([disc #]),,[disc #])
Here, by not entering any instructions to carry out for a positive result, the expression will do just that, and output nothing, but if the [disc #] field does contain data, the expression will write that out. Upon first look, you would think that this could work really well in the "Rename, Move and Copy Files" tool for only creating a \Disc #\ directory if needed. This will not work. When asking the rename tool to create directories from field data, it is smart enough to know that directories with no name are illegal in Windows, so when it encounters an empty field, it automatically converts it to "Unknown [Field Name]". It does this before the expression engine gets to see it, which means that the IsEmpty function will always return a negative result when used in the rename tool, even when the specified field is indeed empty. As we now know that empty fields are passed through the rename tool as "Unknown [field name]" we can use if(isequal([disc #],unknown,8),,[disc #]) to achieve the desired result. Note that this only applies when using the rename files tool.

Add that wiki page to your bookmarks. It's an essential guide for expression building foundations.

-marko.

lepa

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 1978
Re: Please help with renaming rule expression!!
« Reply #2 on: November 06, 2010, 05:36:34 pm »

Somthing like this maybe?

Code: [Select]
If(IsEqual([Album Artist (auto)], [Artist]), Artists\, Compilations\)That of course won't work with for example with Neil Young's Zuma, where artist for one track is Crosby, Stills, Nash & Young. That's why I check if [Album Artist (auto)]=(Multiple Artists)
In this case I have set [Album Artist] to Neil Young

Code: [Select]
If(IsEqual(Mid([Album Artist (auto)],1,16),Multiple Artists,0), Compilations\, Artists\)There might also be a simpler way to deal with this but as above have worked just fine I haven't really studied another way
Logged

darichman

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 1356
Re: Please help with renaming rule expression!!
« Reply #3 on: November 06, 2010, 06:21:08 pm »

Try

if(isequal([Album Artist (Auto)],multiple,8),Compilations,Artists)

For example, I use this expression (where the 'Format' fields are custom fields to clean up filenames):

if(isequal([Album Artist (Auto)],multiple,8),Music\[Format Album Genre]\#Compilations\[Format Folder],Music\[Format Album Genre]\[Album Artist (Auto)]\[Format Folder])

Logged
Pages: [1]   Go Up