More > JRiver Media Center 25 for Mac

regex() string manipulation on MAC

<< < (2/3) > >>

blgentry:

--- Quote from: MartinG on December 19, 2019, 09:35:06 am ---Mhmmm... OK, let's do it with this simple example.
--- End quote ---

This was very helpful.  Thank you for making it simple so we can get to the core of the issue.  :)


--- Quote ---replace([Album],:, /# -#/)
If I insert the suggested line into my version of JRiver (25.0.114, 64bit running on MAC OS Sierra 10.12.6) in the RM&C dialog, the result looks like the screenshot I attached.

--- End quote ---

Agreed.  This behavior is wrong and not at all what you would expect.  This is some of the "weird stuff that RM&C does" that I was explaining.  It mangles certain kinds of expressions and I don't know why.  I think it has to do with the path separator being slash *and* the escape character being slash.  It messes up the interpretation of these characters.


--- Quote ---I just want to do the same with my JRiver MAC version, what I am able to do with the Windows version. AND PLEASE don't tell me: Use the Windows version if it works over there.  ;)
--- End quote ---

I'm probably the last person to tell you to go use Windows.  :)
I agree that you would expect your expression from Windows to work on Mac.  Again, I think it's because of the path separator being slash.  Which is almost exactly what you said in your first post actually.

So here's a workaround that I just tried and it works:

1.  Go to manage library fields and define a new field as Calculated Data.  I called mine [a2].  You can call yours something more meaningful.
2.  Set this as the value for that field in calculated data:

--- Code: ---replace([Album],/# -#/)
--- End code ---
3.  Now go back to RM&C and insert your new field anywhere you need the "translated album value".  It will use the correct characters, replacing the colon.

You can just substitute your new field name everywhere in your original expression that had the "replace" clause.  I think that will mostly work for you.  More comments in my next post.

Brian.

blgentry:
I think this new field [a2] will also work in your regex.  But if it doesn't, maybe I can help you figure out an alternate.  I believe your regex is simply extracting the first word from it's argument.  So the first word of the [Album] in most cases and the first word of something else in other cases.

Let me know if this works, and if not, we can try to figure it out.

Good luck.

Brian.

MartinG:
OK... I will try this.
Do I have to use your modified expression or can I also do it with my original Windows expression replace([Album],:, / /-) ??

Just a quick off topic (concerning MAC vs Windows version):
Having both computers in the same LAN and same switch towards the NAS ... well - no exaggeration - the MAC is round about 10 times faster in extracting Folder.jpg covers from inside the NAS drive compared to the Windows version (Windows 10, i9 CPU, same JRiver version)!!!

blgentry:

--- Quote from: MartinG on December 19, 2019, 11:55:45 am ---OK... I will try this.
Do I have to use your modified expression or can I also do it with my original Windows expression replace([Album],:, / /-) ??

--- End quote ---

I just switched my [a2] to use your definition instead.  It worked the same as mine.

Regarding the speed difference you see, I don't have anything to add.  It's surprising though, that's for sure.

Brian.

MartinG:
Ha! If you could see me now... I have a big smirk from my left ear to my right ear.  ;D
It's working!
Dirty hack, but it's working.
Thanks a lot for the help. Highly appreciated!!!!!
Thank you.
Have some wonderful X-mas days.

Martin

P.S.:
Final note for anybody who is interested in the meaning of the loooooong expression of my first post...

First step:
Extract the first letter of the album title (e.g. Beethoven: Symphony No. 9) to build a main directory (in this case "B")

Second step:
Take the name of the Album which is written before the : and build a subfolder (in this case "Beethoven")

Third step:
As we now have built Volume/B/Beethoven the next step is to build a Foldername that is descriptive for the relevant classical Album. Thus we take again the original [Album] value, replace the : by a - and check, if there is a conductor defined or not. If there is no conductor the expression takes the album artist as relevant value.
IF there is a conductor defined, the expression now checks, if conductor and album artist is the same (to avoid double naming). In our case let's take "Herbert von Karajan" as conductor and also as album artist. In case the album artist is somebody else (in case of piano concerts it could be e.g. Alfred Brendel), the expression first will take the second name of the album artist, followed by a comma, then the second name of the conductor, followed by a comma and finally take the value [Orchestra]. The final information of this expression is the album sample rate (to differentiate between hires albums and normal 44.1 albums).

That means, a final directory could look like this:
Volume/B/Beethoven/Beethoven - Symphony No. 9 - Karajan, Berliner Symphoniker (44.1)
or like this
Volume/B/Beethoven/Beethoven - Piano Concerto No. 5 - Brendel, Haitink, London Philharmonic Orchestra (44,1 kHz)

Now it should be clear what the expression is doing. :)
But take care... the expression is not finalised yet and there is still little work to do to handle albums with various artists or various conductors.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version