INTERACT FORUM

Please login or register.

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

Author Topic: Help with expression to rename files based on empty/nonempty album field  (Read 2194 times)

lise

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 946

I am trying to create a renaming expression for all music files, but I'm having an issue with my directory expression. I've read everything I could find in the wiki and the forum, but I can't figure out what is wrong with my expression.

The result I want:
  If the album field is empty, create an Artist folder, otherwise create Artist\album folders.

My rule: 

If(IsEmpty([Album]),[Artist],[Artist]\[Album])

It turns out that the first [Artist] field is just always being ignored, album or no album.

If there is no album, I get:  B52s\Unknown Album\ 
If there is an album, I get:  B52s\Roam\

I know that the first [Artist] is being ignored, because when I replace it with [Genre], the results are the same (ie no genre shows up when there is no album).

I get the exact same result if I use

If(IsEqual([Album],[],8),[Artist],[Artist]\[Album])

I've created a number of other expressions that work. What am I doing wrong with this one?
Logged
A wise man once said don't count your years, but make your years count. Or was it beers?

gappie

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 4580
Re: Help with expression to rename files based on empty/nonempty album field
« Reply #1 on: February 11, 2009, 02:21:33 pm »

i did not test it lise, but have you tried

If(IsEmpty([Album]),[Artist],[Artist]\\[Album])

 :)
gab
Logged

lise

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 946
Re: Help with expression to rename files based on empty/nonempty album field
« Reply #2 on: February 11, 2009, 02:41:26 pm »

Hey gab,

Yup, tried that. Same result.

Because your suggestion merely added a "\" before the final [album] in my expression, can I assume that the basic structure of my expression is correct and should work, ie

If the album is empty create an Artist folder   If(IsEmpty([album]),[Artist],
otherwise create Artist\Album folders            [Artist[\[Album])
Logged
A wise man once said don't count your years, but make your years count. Or was it beers?

gappie

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 4580
Re: Help with expression to rename files based on empty/nonempty album field
« Reply #3 on: February 11, 2009, 02:59:40 pm »

actually i thought it was right. the "\"trick is the first thing i always try when something does not work. the second one, and i just tested it, is to set a ,0 in the field that does not work. so

If(IsEmpty([Album,0]),[Artist],[Artist]\[Album])

does what you want as far as i see. i think the ',0 give the clean value, or something like that. learned long time ago, forgot what it did.

 :)
gab
Logged

marko

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 9119
Re: Help with expression to rename files based on empty/nonempty album field
« Reply #4 on: February 11, 2009, 03:13:49 pm »

you could also use: if(isequal([album],unknown,8),[artist],[artist]\[album])

empty fields are always translated to "Unknown Field" when using the renaming tool.

-marko

lise

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 946
Re: Help with expression to rename files based on empty/nonempty album field
« Reply #5 on: February 11, 2009, 03:17:06 pm »

Thanks gab. That did the trick.

I had tried adding 0s and 1s but couldn't get it to work. I thought I was following the wiki for IsEmpty:

Quote
Examples:
   IsEmpty([Artist])
   IsEmpty([Duration], 1)

by typing if(IsEmpty([Album],0) (doesn't work)

Your expression: If(IsEmpty([Album,0]does work, so many thanks. I've been at this for hours!
Logged
A wise man once said don't count your years, but make your years count. Or was it beers?

gappie

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 4580
Re: Help with expression to rename files based on empty/nonempty album field
« Reply #6 on: February 11, 2009, 03:17:09 pm »

and what did the ,0 again marco? it could be only you who told me once.  8)

 :)
gab

edit: great it worked lise, i think this part is still wikiless
Logged

lise

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 946
Re: Help with expression to rename files based on empty/nonempty album field
« Reply #7 on: February 11, 2009, 03:18:46 pm »

you could also use: if(isequal([album],unknown,8),[artist],[artist]\[album])

empty fields are always translated to "Unknown Field" when using the renaming tool.

-marko

Thanks marko. I didn't know I could look for 'unknown' rather than empty.
Logged
A wise man once said don't count your years, but make your years count. Or was it beers?

marko

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 9119
Re: Help with expression to rename files based on empty/nonempty album field
« Reply #8 on: February 11, 2009, 03:19:33 pm »

some seriously rapid editing going on in this thread, LOL :D
gappie,
It tells the expression editor to use the raw field data without any formatting.

gappie

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 4580
Re: Help with expression to rename files based on empty/nonempty album field
« Reply #9 on: February 11, 2009, 03:22:46 pm »

some seriously rapid editing going on in this thread, LOL :D
gappie,
It tells the expression editor to use the raw field data without any formatting.
ill stop now  8). not used that threads go that quick. can type, think it over edit and reedit to take away the typos, and if i read the post right i reacted to  ;) before anybody reads. thanks. marco.. that was it. the raw data, so not filling in the unknown from your expression....

 :)
gab

edit: just did a few
Logged
Pages: [1]   Go Up