INTERACT FORUM

Please login or register.

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

Author Topic: [24.0.19; Query] Expression language in Linux  (Read 1632 times)

Gatherum

  • Citizen of the Universe
  • *****
  • Posts: 651
[24.0.19; Query] Expression language in Linux
« on: October 23, 2018, 11:58:57 pm »

What are the differences? I'm migrating my server over to a Debian image and restored my library from back-up. I am now attempting to update the library database to point to the new location (I finally got my VPN to work well enough that I could mount my server's RAID volume as a CIFS share); however, my expressions are flagging with erroneous syntax and I presume that it's because of the character differences in the file systems. I did a search and did not find any documentation on this.

I assume the escape character is different. What is it? What else is different?
Logged

Gatherum

  • Citizen of the Universe
  • *****
  • Posts: 651
Re: [24.0.19; Query] Expression language in Linux
« Reply #1 on: October 24, 2018, 06:09:09 pm »

Nobody knows?
Logged

Gatherum

  • Citizen of the Universe
  • *****
  • Posts: 651
Re: [24.0.19; Query] Expression language in Linux
« Reply #2 on: October 25, 2018, 02:53:35 pm »

So, uh... I kinda need this information. I've finished setting up my new media server and mean to migrate my library over to it. As part of this process, I will need to use the Rename, Move, and Copy Files... feature.
Logged

RoderickGI

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 8186
Re: [24.0.19; Query] Expression language in Linux
« Reply #3 on: October 25, 2018, 08:05:15 pm »

I believe that the main difference is that file paths use Forward Slashes instead of Backslashes, and the escape character is a Backslash instead of a Forward Slash.

But Linux also uses mount points rather than drive letters, so you will need to take that into account. Oh, and file and path Case will now matter.

Did you find and read this: https://yabb.jriver.com/interact/index.php/topic,117593.0.html
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

Gatherum

  • Citizen of the Universe
  • *****
  • Posts: 651
Re: [24.0.19; Query] Expression language in Linux
« Reply #4 on: October 29, 2018, 02:18:49 pm »

I believe that the main difference is that file paths use Forward Slashes instead of Backslashes, and the escape character is a Backslash instead of a Forward Slash.

But Linux also uses mount points rather than drive letters, so you will need to take that into account. Oh, and file and path Case will now matter.

Did you find and read this: https://yabb.jriver.com/interact/index.php/topic,117593.0.html

Thank you. That is a great help.

I have master templates I wrote over time so that I would never have to switch between presets when moving files of any kind. They only pertain to music and videos at the moment but I will probably edit and expand them to account for images as well. This is the one for directories:
Code: [Select]
Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(IfElse(IsEqual([Media Type],Audio),ListBuild(1,\,Music,MoveArticles([Album Artist (auto)]),Delimit([Album],/ /(ListBuild(1,/,/ ,If(Math(!IsEmpty([Disc Catalog #,0])&IsEmpty([Disc #,0])),[Disc Catalog #],[Catalog #,0]),If(IsEqual([Release Type],Live),[Release Type]/ Album,[Release Type]),[Album Version,0],If(!IsEmpty([Disc #,0]),,[Media Format]),If(Math(IsEmpty([Date (override),0])&IsEqual([Date,0],[Date (release),0])|IsEqual([Date (override),0],[Date (release),0])|IsEqual([Release Type],Compilation)),,Ver Rel - FormatDate([Date (release),0],yyyy-MM-dd)))/),/(IfElse(!IsEmpty([Date (override),0]),FormatDate([Date (override),0],yyyy-MM-dd),IsEqual([Release Type],Compilation),FormatDate([Date (release),0],yyyy-MM-dd),1,FormatDate([Date,0],yyyy-MM-dd))/)/ ),Delimit([Disc #,0],Delimit([Disc Name,0],,/ -/ )/ /(ListBuild(1,/,/ ,If(Math(IsEmpty([Disc Catalog #])|IsEqual([Disc Catalog #],[Catalog #])),,[Disc Catalog #,0]),If(IsEqual([Negation Override],Yes),,Delimit([Channels],/ Channels,)),[Media Format],If(Math(IsEqual([Compilation Date Override],No)|IsEmpty([Disc Name,0])|IsEqual([Date,0],[Date (override),0])|IsEqual([Date,0],[Date (release),0])),,Orig Rel - FormatDate(yyyy-MM-dd)))/),Disc/ )),IsEqual([Media Type],Video),ListBuild(1,\,Videos,If(IsEmpty([Franchise,0]),/(Miscellaneous films/),[Franchise]),IfElse(IsEqual([Use chronicle as series in file system,0],Yes),[Chronicle],IsEqual([Franchise,0],[Series,0]),,IsEmpty([Series,0]),,1,[Series]),IfElse(IsEmpty([Season,0]),,IsEqual([Negate season],Yes),,!IsEmpty([Season Designation,0]),[Season Designation] If(!IsEmpty([Season Modifier,0]),If(Compare([Season Modifier,0],<=,9),Delimit([Season Modifier],,0),[Season Modifier]),[Season]),IsEqual([Season,0],Specials),[Season],1,Season If(!IsEmpty([Season Modifier,0]),If(Compare([Season Modifier,0],<=,9),Delimit([Season Modifier],,0),[Season Modifier]),[Season]))Delimit([Season Name,0],,/ –/ ),If(IsEmpty([Grouping,0]),,[Grouping]))),/ /|/ ,/,/ ),/ :/ ,/ –/ ),:/ ,/ –/ ),:,–),?,),/ ////,/,),////,/,/ ),//,/,/ ),",')This is the one for file names:
Code: [Select]
Replace(Replace(Replace(Replace(Replace(IfElse(IsEqual([Media Type],Audio),Delimit([Track #],.,) [Name]Delimit(ListBuild(1,/, ,[Track Version,0],If(IsEqual([Negation Override],No),,Delimit([Channels],/ Channels,)),If(Math(IsEmpty([Artist (original),0])|IsEqual([Album Artist (auto)],[Artist (original)],8)),,Orig Artist - [Artist (original)]),If(Math(!IsEmpty([Date (override),0])&IsEqual([Date,0],[Date (override),0])|!IsEqual([Release Type,0],Compilation)&IsEmpty([Date (override),0])|IsEqual([Date,0],[Date (release),0])|IsEqual([Compilation Date Override],Yes)),,Orig Rel - FormatDate(yyyy-MM-dd))),/),/ (),IsEqual([Media Type],Video),IfElse(IsEqual([Use overall episode in file system,0],Yes),If(Compare([Overall Episode,0],<=,9),Delimit([Overall Episode],/./ ,0),Delimit([Overall Episode],/./ ,)),IsEmpty([Episode,0]),Delimit(FormatDate(yyyy-MM-dd),/)/ ,/(),1,Delimit([Episode],/./ ,))[Name]),:/ ,/ –/ ),?,),////,/,/ ),//,/,/ ),",')I edited them to look like this based on your instruction:
Code: [Select]
Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(IfElse(IsEqual([Media Type],Audio),ListBuild(1,/,Music,MoveArticles([Album Artist (auto)]),Delimit([Album],\ \(ListBuild(1,\,\ ,If(Math(!IsEmpty([Disc Catalog #,0])&IsEmpty([Disc #,0])),[Disc Catalog #],[Catalog #,0]),If(IsEqual([Release Type],Live),[Release Type]\ Album,[Release Type]),[Album Version,0],If(!IsEmpty([Disc #,0]),,[Media Format]),If(Math(IsEmpty([Date (override),0])&IsEqual([Date,0],[Date (release),0])|IsEqual([Date (override),0],[Date (release),0])|IsEqual([Release Type],Compilation)),,Ver Rel - FormatDate([Date (release),0],yyyy-MM-dd)))\),\(IfElse(!IsEmpty([Date (override),0]),FormatDate([Date (override),0],yyyy-MM-dd),IsEqual([Release Type],Compilation),FormatDate([Date (release),0],yyyy-MM-dd),1,FormatDate([Date,0],yyyy-MM-dd))\)\ ),Delimit([Disc #,0],Delimit([Disc Name,0],,\ -\ )\ \(ListBuild(1,\,\ ,If(Math(IsEmpty([Disc Catalog #])|IsEqual([Disc Catalog #],[Catalog #])),,[Disc Catalog #,0]),If(IsEqual([Negation Override],Yes),,Delimit([Channels],\ Channels,)),[Media Format],If(Math(IsEqual([Compilation Date Override],No)|IsEmpty([Disc Name,0])|IsEqual([Date,0],[Date (override),0])|IsEqual([Date,0],[Date (release),0])),,Orig Rel - FormatDate(yyyy-MM-dd)))\),Disc\ )),IsEqual([Media Type],Video),ListBuild(1,/,Videos,If(IsEmpty([Franchise,0]),\(Miscellaneous films\),[Franchise]),IfElse(IsEqual([Use chronicle as series in file system,0],Yes),[Chronicle],IsEqual([Franchise,0],[Series,0]),,IsEmpty([Series,0]),,1,[Series]),IfElse(IsEmpty([Season,0]),,IsEqual([Negate season],Yes),,!IsEmpty([Season Designation,0]),[Season Designation] If(!IsEmpty([Season Modifier,0]),If(Compare([Season Modifier,0],<=,9),Delimit([Season Modifier],,0),[Season Modifier]),[Season]),IsEqual([Season,0],Specials),[Season],1,Season If(!IsEmpty([Season Modifier,0]),If(Compare([Season Modifier,0],<=,9),Delimit([Season Modifier],,0),[Season Modifier]),[Season]))Delimit([Season Name,0],,\ –\ ),If(IsEmpty([Grouping,0]),,[Grouping]))),\ \|\ ,\,\ ),\ :\ ,\ –\ ),:\ ,\ –\ ),:,–),?,),\ \/\/,\,),\/\/,\,\ ),\/,\,\ ),",')
Code: [Select]
Replace(Replace(Replace(Replace(Replace(IfElse(IsEqual([Media Type],Audio),Delimit([Track #],.,) [Name]Delimit(ListBuild(1,\, ,[Track Version,0],If(IsEqual([Negation Override],No),,Delimit([Channels],\ Channels,)),If(Math(IsEmpty([Artist (original),0])|IsEqual([Album Artist (auto)],[Artist (original)],8)),,Orig Artist - [Artist (original)]),If(Math(!IsEmpty([Date (override),0])&IsEqual([Date,0],[Date (override),0])|!IsEqual([Release Type,0],Compilation)&IsEmpty([Date (override),0])|IsEqual([Date,0],[Date (release),0])|IsEqual([Compilation Date Override],Yes)),,Orig Rel - FormatDate(yyyy-MM-dd))),\),\ (),IsEqual([Media Type],Video),IfElse(IsEqual([Use overall episode in file system,0],Yes),If(Compare([Overall Episode,0],<=,9),Delimit([Overall Episode],\.\ ,0),Delimit([Overall Episode],\.\ ,)),IsEmpty([Episode,0]),Delimit(FormatDate(yyyy-MM-dd),\)\ ,\(),1,Delimit([Episode],\.\ ,))[Name]),:\ ,\ –\ ),?,),\/\/,\,\ ),\/,\,\ ),",')...These are damned hard to read, I know, so the basic gist is that all instances of forward slashes as escape characters were changed to back slashes and all instances of slashes as delimiters (ListBuild(), to separate directories) or as file name elements (as inputs to Replace()) were changed to forward slashes. In theory, this should work as-is; however, plugging these in to MC's Rename, Move, and Copy function on the Linux machine still flags syntax errors. Checking the Convert Windows File Path Syntax option does work as expected and it'll be handy for the initial migration; after that, I'll need working templates for adding new assets to the server.

Am I still missing something key?

Also, just so I know, do Linux file systems (ext4, in this case) ignore articles by default or do they function much like Windows' in that regard? And which characters, besides the forward slash, are illegal in file and directory naming?
Logged

RoderickGI

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 8186
Re: [24.0.19; Query] Expression language in Linux
« Reply #5 on: October 29, 2018, 08:01:33 pm »

I'm afraid I can't help much more. Hopefully a Linux and expression guru will step forward.

But in analysing your code, do you use a programming tool? I use Notepad++ and find it excellent. I even have a JRiver Media Center language set up in it (I must have found that at some stage and installed it) that does a bit of colour coding of the expressions to try to highlight issues. See first image.

I suspect that the orange section has something wrong, but Notepad++ isn't even getting all bracket pairs right, mainly because you seem to have a lot of custom fields and you are calling out raw field data a lot, which the language module doesn't understand. Also, field names with brackets in them, such as [Album Artist (auto)] seem to confuse it.

Anyway, using Notepad++ or something similar to indent the code to make it more readable would be the way I would try to identify problems. Plus breaking the one big piece of code down into smaller self-contained pieces and testing each of those. See the second image for an example I started on your code.

I had a quick go at indenting your first code. Not sure I got it right. I still get syntax errors, but I didn't actually try to debug the code. XML file attached.

BTW, I believe that MC can accept indented code like that as it is. So edit outside MC with indenting and just paste it in as is for testing.
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

RoderickGI

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 8186
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

blgentry

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 8014
Re: [24.0.19; Query] Expression language in Linux
« Reply #7 on: October 30, 2018, 03:29:02 pm »

I have master templates I wrote over time so that I would never have to switch between presets when moving files of any kind. They only pertain to music and videos at the moment but I will probably edit and expand them to account for images as well.

As you say later on, these are incredibly difficult to read.

It might be smart for you to break these up into functional units and then build MC calculated fields with them.  Then, use those calculated field names in your expressions.  Not only might you save some code duplication, you should gain some readability, as the nesting will be more limited.

Also, you might try some limited snippets of your code in the RM&C dialogs to see if they act as you expect.  You're probably going to find that one or two of them do different things with the Linux version.  I've had difficulty in the past with using Expressions inside of RM&C (on the Mac).  At a certain point (I don't remember exactly where) expressions just didn't behave as I expected, but ONLY inside of RM&C.  You might try your giant expressions as an expression column in a view and see how they look there.  If they work in a column but not in RM&C, then it's an RM&C specific problem.

Quote
Also, just so I know, do Linux file systems (ext4, in this case) ignore articles by default or do they function much like Windows' in that regard? And which characters, besides the forward slash, are illegal in file and directory naming?

Linux does not ignore anything, so articles are articles.  I can't think of very many illegal characters in the ext4 file system, though I can tell you that unicode characters seem to act weird when switching file systems.  So, if your file names contain international characters (accents and things like that), then your file names might get a little mangled between windows and Linux.  I've had this happen between Mac and Linux.

I'm surprised that you are changing platforms.  You seem to be a long time Windows MC customer.  As such, I actually would not expect you to be satisfied with the Linux version, since it lacks a lot of the "wow" features of MC for Windows *and* lacks at least one very basic function.

I'm not insulting MC for Linux.  Just stating my opinion.  I use MC for Linux on two different computers and am mostly satisfied.

Brian.
Logged

mattkhan

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 4231
Re: [24.0.19; Query] Expression language in Linux
« Reply #8 on: October 30, 2018, 05:36:49 pm »

I have no idea how you could maintain a "script" like that so, on the grounds this might be an xy sort of thread, I wonder if there is a simpler solution to the problem (whatever the problem is... as it's not clear why you need such an expression)
Logged

RoderickGI

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 8186
Re: [24.0.19; Query] Expression language in Linux
« Reply #9 on: October 30, 2018, 07:51:16 pm »

this might be an xy sort of thread

I see those all the time here. That is partly why I didn't try too hard to understand the expression. It is certainly hard to read! But it does a lot.
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