INTERACT FORUM

Please login or register.

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

Author Topic: Rename, Move & Copy File -- Question regarding expression language  (Read 1943 times)

chris13

  • Junior Woodchuck
  • **
  • Posts: 64

Hi Forum,

i'm currently in the process of reorganizing my music library.
I want to achieve the following file structure:
1. Multi-disc albums shall be placed in sub-folder Disc 1, Disc 2, ...
I'll achieve this by following expression:

if(IsEqual([Total Discs],1,2),
[Genre]\[Album Artist (auto)]\[Year - Album],
[Genre]\[Album Artist (auto)]\[Year - Album]\Disc [disc #])

2. The different Release-Types shall be placed in a dedicated sub-folder
For this i created a user-defined field named [Release Type] with the following values:
- Album
- Live Album
- Single
- EP
- Bootleg
Note: The value Album for Release Type is only needed in JRiver, but not in the file structure. If it would be more simple without the value Album i could get rid of it.
I'll achieve this by the following expression:

if(math(IsEqual([Release Type], Single)| IsEqual([Release Type], EP)| IsEqual([Release Type], Live Album)| IsEqual([Release Type], Bootleg)| IsEqual([Release Type], Compilation)),
[Genre]\[Album Artist (auto)]\[Release Type]\[Year - Album],
[Genre]\[Album Artist (auto)]\[Year - Album])

Questions:
1. How to bring this 2 expressions together, or is there an other simple way to do this?
2. I want to use this structure also for my handheld (sd-card) -- Will the processing take much longer because of all the math behind?

Thank you in advance
Logged

blgentry

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 8014
Re: Rename, Move & Copy File -- Question regarding expression language
« Reply #1 on: August 27, 2017, 08:48:21 am »

You should probably restructure your expression so that your tests are inside the expression, as opposed to having two different expressions per test.  Using this method:

https://wiki.jriver.com/index.php/Rename,_Move,_and_Copy_Files#Empty_Fields

For example, your first expression could be re-written as:

Code: [Select]
[Genre]\[Album Artist (auto)]\[Year - Album]\if(IsEqual([Total Discs],1,5),Disc [disc #],)
Notice that I changed your test to "total discs Greater Than 1".  Also notice that the else clause is empty, so it outputs nothing.

You can then roll in your Release Type test.  The simple way to do that is to test to see if it's value is "Album".  If it is, output nothing.  Else, output the [Release Type] field.

I'm intentionally leaving this as an exercise for you, as you seem to be getting good with expressions and you'll probably have fun making this whole expression correct by yourself.  If you need more help, please ask.

Good luck!

Brian.
Logged

chris13

  • Junior Woodchuck
  • **
  • Posts: 64
Re: Rename, Move & Copy File -- Question regarding expression language
« Reply #2 on: August 27, 2017, 10:46:01 am »

Great, thank you for the tips. :)
I solved it this way:
[Genre]\[Album Artist (auto)]\if(math(IsEqual([Release Type], Album)), ,[Release Type])\[Year - Album]\if(IsEqual([Total Discs],1,5),Disc [disc #],)
Logged

blgentry

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 8014
Re: Rename, Move & Copy File -- Question regarding expression language
« Reply #3 on: August 27, 2017, 11:44:02 am »

Awesome!  Good job.  :)

Brian.
Logged
Pages: [1]   Go Up