INTERACT FORUM

Please login or register.

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

Author Topic: Expression Language Issue  (Read 2277 times)

BrownBear

  • Recent member
  • *
  • Posts: 23
Expression Language Issue
« on: May 31, 2017, 10:26:56 am »

Hi All,

I am a big fan of JRiver and its expression language which makes managing libraries so much easier and organizing my media a dream. I have been playing around with it on a windows machine and everything works well, however I have recently tried the same approach on my Macbook (15" late 2013 model running OSX Sierra) and found an issue which I don't know how to resolve.

Example of what I am trying to do is to rename the folder and files for movies to the following format:
/somePath/Movies/Movie Name (Year)/Movie Name.ext
or if the year is empty:
/somePath/Movies/Movie Name/Movie Name.ext

In windows version of JRiver I can use the below for the directory rule on the Rename and Move window (F6):

ifElse( isEqual([Media Sub Type],"Movie",1), Clean(Replace([Name],:,/,))if(isEmpty([Year],1),,/ /([Year]/)), <next condition for ifelse>)

I wrote the above from memory so might not be 100% correct, however the issue I seem to face is the escape character "/" not working as expected on Mac (based on the output results shown in the same window). Is this since the "/" also used by the OS to split directories?

In the above example the replace statement does not work correctly as the last comma is not escaped. Also, adding a space between the movie name and year does not work, and lastly the escaping of the round brackets seems to break, especially the closing bracket seems to close the IF condition, thus breaking the entire expression.

Do I need to escape round brackets, commas and spaces in another way on a Mac?

Thanks in advance for any help.
 
Logged

blgentry

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 8009
Re: Expression Language Issue
« Reply #1 on: May 31, 2017, 11:03:20 am »

I'm not in front of a Mac right now, so I can't test your expression.  I'll try to remember to play around with it tonight.  The RM&C tool seems to have a limitation in what expressions it will process.  I can't remember the precise issue I had that demonstrated that to me, but I know I've been unable to use certain expressions in the RM&C tool in the past on MC for Mac.  It's been a while.

I do remember that I was able to work around some of these problems by creating a new field and putting my expression into that field.  Then using the field inside the RM&C dialog.  I think this worked.

If you can post your exact expression, I can try it and see if I can make it work.  Again, I'll try to remember to play with this when I get to my Mac later today.

Good luck.

Brian.
Logged

BrownBear

  • Recent member
  • *
  • Posts: 23
Re: Expression Language Issue
« Reply #2 on: May 31, 2017, 11:10:22 am »

Thanks, I will post the expression tonight.
Logged

BrownBear

  • Recent member
  • *
  • Posts: 23
Re: Expression Language Issue
« Reply #3 on: May 31, 2017, 01:31:19 pm »

Here is the example (broken down) of the expression for directory names which works on the windows JRiver version but not on mac.

IfElse(
   IsEqual([Media Type],Video,0),
      If(IsEqual([Media Sub Type],Movie,0),
         If(IsEmpty([Name]),,Replace([Name],:,/,)If(IsEmpty([Year],1),,/ /([Year]/))),)
      If(IsEqual([Media Sub Type],TV Show,0),
         If(IsEmpty([Series]),,Replace([Series],:,/,)\If(IsEmpty([Season],1),,Season [Season])),),
   IsEqual([Media Type],Audio,0),
      Clean(Replace([Album Artist],:,/,))\Clean(Replace([Album],:,/,))if(IsEmpty([Disc #],1),, [Disc [Disc #]])
)

Everywhere were I try escape (using "/") characters it does not work and just creates a sub directory or break the expression.
Logged

Awesome Donkey

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 7398
  • The color of Spring...
Re: Expression Language Issue
« Reply #4 on: May 31, 2017, 01:38:26 pm »

Yeah, you'll have to change the expression on Mac, since Mac and Windows are two different beasts with different types of path support.
Logged
I don't work for JRiver... I help keep the forums safe from Viagra and other sources of sketchy pharmaceuticals.

Windows 11 2023 Update (23H2) 64-bit + Ubuntu 24.04 LTS Noble Numbat 64-bit | Windows 11 2023 Update (23H2) 64-bit (Intel N305 Fanless NUC 16GB RAM/256GB NVMe SSD)
JRiver Media Center 32 (Windows + Linux) | iFi ZEN DAC 3 | Edifier R2000DB Bookshelf Speakers | Audio-Technica ATH-M50x Headphones

BrownBear

  • Recent member
  • *
  • Posts: 23
Re: Expression Language Issue
« Reply #5 on: May 31, 2017, 02:20:03 pm »

OK...

So the question would be how to escape a space or a bracket ")" on mac in an expression to add it in the name or path? Is it possible with the expression language on mac?
Logged

blgentry

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 8009
Re: Expression Language Issue
« Reply #6 on: May 31, 2017, 04:44:35 pm »

So here's the easy way:  Sort all of your movies by year.  Select all of them that have a value in the year field.  Now run RM&C on them.  See attached screen shot for a simple setup that names files like your example.

Then, select all of the movies that do not have a year field.  Run RM&C on these files.  Now change the expression to omit the year part.  Done.

Two quick passes and all of your movies will be renamed as you want them.

Brian.
Logged
Pages: [1]   Go Up