INTERACT FORUM

More => Old Versions => JRiver Media Center 26 for Windows => Topic started by: bytestar on February 14, 2020, 04:16:14 pm

Title: Auto import rule what am I doing wrong?
Post by: bytestar on February 14, 2020, 04:16:14 pm
IfElse(
IsEqual([Filename (path)],\Music\CD, Compilation,8),Various Artists,
IsEqual([Filename (path)],\Music@slg\Vinyl,8),listitem([Filename (path)],3,\)

I get an expression error
Title: Re: Auto import rule what am I doing wrong?
Post by: mwillems on February 14, 2020, 05:59:49 pm
IfElse(
IsEqual([Filename (path)],\Music\CD, Compilation,8),Various Artists,
IsEqual([Filename (path)],\Music@slg\Vinyl,8),listitem([Filename (path)],3,\)

I get an expression error

You're missing a closing parenthesis for the ifElse, no?
Title: Re: Auto import rule what am I doing wrong?
Post by: RoderickGI on February 14, 2020, 06:05:01 pm
You need to escape your backslashes, or at least the one used as the ListItem delimiter. Probably in the IsEqual expressions as well.

Your third line looks wrong as well. Yep, missing a closing bracket.

IfElse(
IsEqual([Filename (path)],\Music\CD, Compilation,8),Various Artists,
IsEqual([Filename (path)],\Music@slg\Vinyl,8),listitem([Filename (path)],3,\\)
)

or

IfElse(
IsEqual([Filename (path)],\\Music\\CD, Compilation,8),Various Artists,
IsEqual([Filename (path)],\\Music@slg\\Vinyl,8),listitem([Filename (path)],3,\\)
)

Not sure which.

Also, doesn't your [Filename (path)] have a drive letter at the front? If you are using URIs instead of drive mapping, then "\\Music\CD" would need to be expressed as "\\\\Music\\CD", if backslashes need to be escaped inside an IsEqual expression.



Beaten   :(.. on part of it  :)
Title: Re: Auto import rule what am I doing wrong?
Post by: bytestar on February 16, 2020, 02:25:09 pm
Thank you for that

IfElse(
IsEqual([Filename (path)],Music\CD, Compilation,8),Various Artists,
IsEqual([Filename (path)],Music\Music@slg\Vinyl,8),listitem([Filename (path)],3,\)
)

Now works for me, but the line with CD, Compilation does not works. Only when i use "CD Compilation" for Folder and Expression (without "," between CD, Compilation.)
What can I do if I use still CD, compilation for Folder Name and Expression ?

You need to escape your backslashes, or at least the one used as the ListItem delimiter. Probably in the IsEqual expressions as well.

Your third line looks wrong as well. Yep, missing a closing bracket.

IfElse(
IsEqual([Filename (path)],\Music\CD, Compilation,8),Various Artists,
IsEqual([Filename (path)],\Music@slg\Vinyl,8),listitem([Filename (path)],3,\\)
)

or

IfElse(
IsEqual([Filename (path)],\\Music\\CD, Compilation,8),Various Artists,
IsEqual([Filename (path)],\\Music@slg\\Vinyl,8),listitem([Filename (path)],3,\\)
)

Not sure which.

Also, doesn't your [Filename (path)] have a drive letter at the front? If you are using URIs instead of drive mapping, then "\\Music\CD" would need to be expressed as "\\\\Music\\CD", if backslashes need to be escaped inside an IsEqual expression.



Beaten   :(.. on part of it  :)
Title: Re: Auto import rule what am I doing wrong?
Post by: RoderickGI on February 16, 2020, 04:39:40 pm
You didn't need to escape any backslashes? Interesting... I just tested some parts of your expression, and indeed escaping is not required. I must refresh myself on when it is required.


Just look at your IsEqual expression again, in isolation:

IsEqual([Filename (path)],Music\CD, Compilation,8)

Compared to the Wiki definition:

IsEqual(value1, value2, mode)

Value1 = "[Filename (path)]"  That's OK.
Mode = "8"  That's OK.
So Value2 = "Music\CD, Compilation"  Well that's obviously not right.

What is right depends on what your directory structure actually is, and what you are looking for. If your directory structure actually is "Music\CD Compilation\", then naturally you need to drop the extra coma. I missed that earlier. Sorry. But so did mwillems!  ;D


To test these things, I just create an Expression Column in a View, using components of the expression to test the parts.

I was wrong about needing to have a drive letter at the front of the text tested against the [Filename (path)] as well, because you are using a "Substring search (case insensitive)", not a "Case-insensitive string compare for equality". Oops again.