INTERACT FORUM

Please login or register.

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

Author Topic: Expression Writing: If Statement error concerning Parenthesis  (Read 847 times)

dreandre

  • Junior Woodchuck
  • **
  • Posts: 66

Doing some writing today using Rename, Move, & Copy Files.

When I write the Following Rule in Filename:

if(isequal([media sub type],TV Show),S[Season]E[Episode] [Name],[Name] ([year]))

The True Statement is incorrect:

i.e.  S01E01 The Sword of Omens).mkv


But the False Statement is Correct:

i.e.  I Am Heath Ledger (2017)



It looks as if the IF statement is stealing the first close parenthesis at the end to close out the IF statement, leaving the second parenthesis to add on to the result.   Shouldn't the IF statement be using the LAST parenthesis to close out the IF Statement, leaving the first close parenthisis to remain as a part of the False Value?


Am I missing something here?


Thanks as always for your support!!
Logged

dreandre

  • Junior Woodchuck
  • **
  • Posts: 66
Re: Expression Writing: If Statement error concerning Parenthesis
« Reply #1 on: April 07, 2019, 05:44:42 pm »

OK, looks like if I just change what I want from "I Am Heath Ledger (2017)" to "I Am Heath Ledger [2017]" it works around the parenthesis confusion...
Logged

RoderickGI

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 8186
Re: Expression Writing: If Statement error concerning Parenthesis
« Reply #2 on: April 07, 2019, 07:09:25 pm »

Square brackets, [], can be an issue in file names. I wouldn't use those. Besides, the format "[Name] ([Year]).ext" is most common for movies.

if(isequal([media sub type],TV Show),S[Season]E[Episode] [Name],[Name] /([year]/))

You need to escape the brackets that you want to appear as text, rather than be considered part of the expression. I haven't tested that, but it looks right.

Search for and read about "escape" on this page: https://wiki.jriver.com/index.php/Expression_Language

if(
   isequal(
              [media sub type],TV Show
   )
   ,S[Season]E[Episode] [Name],
   [Name] /([year]/)
)
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

dreandre

  • Junior Woodchuck
  • **
  • Posts: 66
Re: Expression Writing: If Statement error concerning Parenthesis
« Reply #3 on: April 07, 2019, 07:30:22 pm »

Ah!!  Thank you!!!  I get this and that solved the issue!!!
Logged
Pages: [1]   Go Up