INTERACT FORUM

Please login or register.

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

Author Topic: Auto import rule what am I doing wrong?  (Read 536 times)

bytestar

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 1286
  • Alpha/Betatester
Auto import rule what am I doing wrong?
« 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
Logged
Official Microsoft © product tester.
Download the latest language file https://1drv.ms/u/s!AnQ3L_bTnnzv4otXL9-G4rUj9wX6Tw?e=TLGgjb (is constantly updated)

mwillems

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 5234
  • "Linux Merit Badge" Recipient
Re: Auto import rule what am I doing wrong?
« Reply #1 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?
Logged

RoderickGI

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 8186
Re: Auto import rule what am I doing wrong?
« Reply #2 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  :)
Logged
What specific version of MC you are running:MC27.0.27 @ Oct 27, 2020 and updating regularly Jim!                        MC Release Notes: https://wiki.jriver.com/index.php/Release_Notes
What OS(s) and Version you are running:     Windows 10 Pro 64bit Version 2004 (OS Build 19041.572).
The JRMark score of the PC with an issue:    JRMark (version 26.0.52 64 bit): 3419
Important relevant info about your environment:     
  Using the HTPC as a MC Server & a Workstation as a MC Client plus some DLNA clients.
  Running JRiver for Android, JRemote2, Gizmo, & MO 4Media on a Sony Xperia XZ Premium Android 9.
  Playing video out to a Sony 65" TV connected via HDMI, playing digital audio out via motherboard sound card, PCIe TV tuner

bytestar

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 1286
  • Alpha/Betatester
Re: Auto import rule what am I doing wrong?
« Reply #3 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  :)
Logged
Official Microsoft © product tester.
Download the latest language file https://1drv.ms/u/s!AnQ3L_bTnnzv4otXL9-G4rUj9wX6Tw?e=TLGgjb (is constantly updated)

RoderickGI

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 8186
Re: Auto import rule what am I doing wrong?
« Reply #4 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.
Logged
What specific version of MC you are running:MC27.0.27 @ Oct 27, 2020 and updating regularly Jim!                        MC Release Notes: https://wiki.jriver.com/index.php/Release_Notes
What OS(s) and Version you are running:     Windows 10 Pro 64bit Version 2004 (OS Build 19041.572).
The JRMark score of the PC with an issue:    JRMark (version 26.0.52 64 bit): 3419
Important relevant info about your environment:     
  Using the HTPC as a MC Server & a Workstation as a MC Client plus some DLNA clients.
  Running JRiver for Android, JRemote2, Gizmo, & MO 4Media on a Sony Xperia XZ Premium Android 9.
  Playing video out to a Sony 65" TV connected via HDMI, playing digital audio out via motherboard sound card, PCIe TV tuner
Pages: [1]   Go Up