INTERACT FORUM

More => Old Versions => JRiver Media Center 24 for Windows => Topic started by: dreandre on April 07, 2019, 03:34:36 pm

Title: Expression Writing: If Statement error concerning Parenthesis
Post by: dreandre on April 07, 2019, 03:34:36 pm
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!!
Title: Re: Expression Writing: If Statement error concerning Parenthesis
Post by: dreandre 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...
Title: Re: Expression Writing: If Statement error concerning Parenthesis
Post by: RoderickGI 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]/)
)
Title: Re: Expression Writing: If Statement error concerning Parenthesis
Post by: dreandre on April 07, 2019, 07:30:22 pm
Ah!!  Thank you!!!  I get this and that solved the issue!!!