INTERACT FORUM

Please login or register.

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

Author Topic: working with loops for directory naming possible?  (Read 968 times)

MartinG

  • Junior Woodchuck
  • **
  • Posts: 58
working with loops for directory naming possible?
« on: February 10, 2020, 09:54:21 am »

Actually I tried to find a solution for my problem but wasn't successful yet...
So what is my aim:
Briefly spoken I want to copy/move many(!) files of classical music of an existing file structure into a new logical structure by using the embedded meta tags for directory naming.
E.g.:
Old structure
//itunes/music/Leonard Bernstein/Beethoven Symphonies 1&3/Track-xy.mp4
New structure
//music/Beethoven/Symphony Nos 1&3 - Bernstein, London Symphony Orechestra (1984)/Track-xy.mp4

What sounds simple when using JRiver Expression Language isn't simple at all. Imagine the variety of multiple conductors, recording dates or composers on a single disc! As soon as defined meta tags [composer] [conductor] [orchestra] [date] of the single tracks of a CD start to vary, the disc will be split into different directories... which I would like to avoid.

Thus I would like to know, is it possible to work with loops inside JRiver Expression Language?
E.g. Check the recording date of all tracks of a disc and only use this value if it is the same for all tracks of the recording.
or
Use the value [conductor] when it is the same for all tracks of the disk?

Thanks for any help
Martin
Logged

JimH

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 72438
  • Where did I put my teeth?
Re: working with loops for directory naming possible?
« Reply #1 on: February 10, 2020, 10:05:42 am »

MC's tool called Rename, Move, & Copy can do that.  The wiki has a topic.

Be careful.
Logged

MartinG

  • Junior Woodchuck
  • **
  • Posts: 58
Re: working with loops for directory naming possible?
« Reply #2 on: February 10, 2020, 10:09:03 am »

Do you have a link for me?
Using the expression "loop" did not lead to any helpful search results.
Thanks
Logged

Moe

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 718
  • Hi
Logged

MartinG

  • Junior Woodchuck
  • **
  • Posts: 58
Re: working with loops for directory naming possible?
« Reply #4 on: February 10, 2020, 10:24:11 am »

Thanks a lot.
But actually I do know this wiki pretty well and I can't find any help concerning my question. There is no description about loop functionality or is it that I am just too fond of trees to see the wood?!
 ?
Logged

JimH

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 72438
  • Where did I put my teeth?
Re: working with loops for directory naming possible?
« Reply #5 on: February 10, 2020, 10:30:06 am »

I don't think you need to loop anything.
Logged

Moe

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 718
  • Hi
Re: working with loops for directory naming possible?
« Reply #6 on: February 10, 2020, 10:34:14 am »

Yes, don't focus on loops.  Read the page I linked you to and then read it again, it's a very robust tool and is very powerful.  Make a back-up and start small.  If you get stuck with something specific ask for help.  If you do need help, provide as much information as possible, especially the fields/values you are trying to use in your rules.
Logged

JimH

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 72438
  • Where did I put my teeth?
Re: working with loops for directory naming possible?
« Reply #7 on: February 10, 2020, 10:34:48 am »

And experiment with it.
Logged

MartinG

  • Junior Woodchuck
  • **
  • Posts: 58
Re: working with loops for directory naming possible?
« Reply #8 on: February 10, 2020, 10:45:22 am »

OK, seems to be that I have to prove that I am used to this tool...
My current string looks like this:
Left(MoveArticles([Album]),1)/ [-AlbumNameVorDoppelPkt]/ [-AlbumNameOhneDoppelPkt] - if(isequal([Dirigent], Unbekannt Dirigent),[Albuminterpret], if(isequal([Albuminterpret],[-DirigentOhneSir]), [-AlbumInterpNachName] [Orchester], [-AlbumInterpNachName] [-DirigentNachName] [Orchester])) ([Abtastrate])

and is a modification with defined phrases of the string below as the one below caused problems on a MAC system

Left(MoveArticles([Album]),1)\
regex(replace([Album],:, / /-),/#([^\s,]+)#/,-1,1)[R1]\
replace([Album],:, / /-) - if(isequal([Dirigent], Unbekannt Dirigent),[Albuminterpret], if(isequal([Albuminterpret],if(isequal(Left([Dirigent],3),Sir),removeleft([Dirigent],4),[Dirigent]),1), regex(Swap([Albuminterpret]),/#([^\s,]+)#/,-1,1)[R1]/, [Orchester], regex(Swap([Albuminterpret]),/#([^\s,]+)#/,-1,1)[R1]/, regex(Swap([Dirigent]),/#([^\s,]+)#/,-1,1)[R1]/, [Orchester])) ([Abtastrate])

However, this is just to show you, that I am not new to the JRiver scripting language and that I really love "to play" with it. However, the string above leads exactly to the problem, that disks with multiple conductors or interprets get split into two or more directories, so that I would like to work with a loop to check track "structure" before writing a directory.
This is what I try to do and where I can't find a solution.
So, Jim wrote it is possible to work with loops. How does an example expression look like?

Thanks again for your very speedy reaction to my post.  :)
Martin
Logged

MartinG

  • Junior Woodchuck
  • **
  • Posts: 58
Re: working with loops for directory naming possible?
« Reply #9 on: February 10, 2020, 10:48:27 am »

by the way... for anybody who is interested in:
The above string leads exactly to a directory like this

/B/Beethoven/Beethoven - Symphonie Nr. 9 (1988) - Muti, Philharmonia Orchestra (44,1 kHz)

where "B" is the first digit of the second name of the vale [composer], "Beethoven" is the second name of the value [composer], "Beethoven - Symphonie Nr. 9 (1988)" is the name of the value [album], "Muti" is the second name of the meta tag [conductor], "Philharmonia Orchestra" is the value [orchestra] and finally there is the resolution of the recording.

Again... this string inside the tool "Rename, Move, & Copy" works like charm... but leads to the problem I tried to explain in my first post. So there is a need to check if one of the relevant meta tags varies inside a single album to react on it. Thus I was asking for a loop functionality. Without loop I don't know how to handle the problem.

Martin
Logged

Moe

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 718
  • Hi
Re: working with loops for directory naming possible?
« Reply #10 on: February 10, 2020, 11:15:13 am »

Quote
OK, seems to be that I have to prove that I am used to this tool...

We get a lot of people here who don't know expressions at all so it's often best to start small.  Looks like we don't have to do that for you as you obviously have a good grasp of the expression language!!

Can you provide a screenshot of some of the files that you have that shows how you have them tagged and then share the end result you are looking for for those files?  It's a pretty complex question and without having the actual data to play with it's tough to figure out.
Logged

MartinG

  • Junior Woodchuck
  • **
  • Posts: 58
Re: working with loops for directory naming possible?
« Reply #11 on: February 10, 2020, 12:16:42 pm »

 ;) I know.
OK... let's go.
A very common case is an album like e.g. this one: Anne-Sophie Mutter, Tchaikovsky; Korngold - Violin concertos.
https://www.discogs.com/Anne-Sophie-Mutter-Tchaikovsky-Korngold-Andr%C3%A9-Previn-Wiener-Philharmoniker-London-Symphony-Orchestr/release/4482663

Using the given expression (asking for the values composer, conductor, artist, album, orchestra) it will split the album into two directories with the names:
/T/Tschaikowski, Korngold - Violinkonzerte (2003) - Mutter, Previn, Wiener Philharmoniker (88,2 kHz)
and
/T/Tschaikowski, Korngold - Violinkonzerte (2003) - Mutter, Previn, London Symphony Orchestra (88,2 kHz)

Reason is, that the tag value [orchestra] varies, even though album, artist and conductor are persistent.

Thus my idea was to do a consistency check (loop) of one (or more) relevant tags before using exactly these tags as values for directory naming. In precise words:
If consistency check of tag [orchestra] within all tracks of [album] fails, make directory name [album] - [artist], else make directory name [album] - [artist], [conductor], [orchestra]

leading in this specific case to the following directory name
/T/Tschaikowski, Korngold - Violinkonzerte (2003) - Mutter, Previn (88,2 kHz)

So I have to loop all tracks of an album before action. (I guess that there is no way)
Origin of my thoughts was the value [date] which is of essential meaning for classical records. Just take Karajans work for example. He conducted Beethoven's symphonies several times with the Berlin Philharmonics. So I wanted to take this value for directory naming and directly run into the problem that on one and the same CD the recording dates of just two symphonies varied. As a result of this I manually added the date to the album name (which is not very elegant), but this does not solve the problem with conductors and orchestras.
Did you get my problem?
Logged

blgentry

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 8014
Re: working with loops for directory naming possible?
« Reply #12 on: February 10, 2020, 03:21:01 pm »

It's unfortunate that the Expression Language does not contain real looping constructs.  Well... supports an odd version of loops.  You might look into Global Variables, but I'm really not sure they will help you for what you are trying to do.  You might be able to get it to work.  Maybe read one of Mr. C's tutorials on Global Variables and do an experiment or two.

What you're really looking for is "does this tag change within the album" functionality.  Which is already in MC in several places.  For example, if you look at the album in the Tag Window any tag with different values will say "Varies".

But... I don't think you can access that from the Expression Language.  ...and how would you even tell it to?  Because the Expression Language is typically applied to each file, one by one. 

I can't come up with anything clever.  Perhaps someone else has more ideas for you.

Good luck.

Brian.
Logged

Moe

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 718
  • Hi
Re: working with loops for directory naming possible?
« Reply #13 on: February 11, 2020, 10:37:50 am »

I have a feeling what you're trying to do is going to be too much for RMC too handle.  I would suggest taking a look at MrC's pscriptor as I think it could probably do what you want to do.  Use pscriptor to write the wanted value to a field and then use that field in RMC.
Logged

MartinG

  • Junior Woodchuck
  • **
  • Posts: 58
Re: working with loops for directory naming possible?
« Reply #14 on: February 11, 2020, 10:52:45 am »

Yes, you're right. That also was my feeling. Thank you very much for the hint. I will have a look.
Logged

ferday

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 1732
Re: working with loops for directory naming possible?
« Reply #15 on: February 12, 2020, 07:48:57 pm »

loops would be my favourite feature, but would also cause a huge amount of headaches so i understand

you could make a global variable with your check in it, then check for the value of that variable (like a boolean).  it could work, maybe...
Logged
Pages: [1]   Go Up