INTERACT FORUM

Please login or register.

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

Author Topic: Filling custom tag using data from another tag  (Read 2993 times)

Wavry

  • Recent member
  • *
  • Posts: 5
Filling custom tag using data from another tag
« on: May 02, 2017, 07:23:53 pm »

Hi guys newbie user here so forgive my ignorance, but I've created a custom tag called Featured Artist, is there any way for me to fill this tag out automatically using data from the songname or artist field?

For instance I have Hallelujah Money by Gorillaz feat. Benjamin Clementine

Hallelujah Money being stored in the Name field, and then Gorillaz feat. Benjamin Clementine being stored in the artist field, but I'd like to be able to have JRiver search for the keywords feat or ft or any other variation and then remove that from the current field and place it in my custom Featured Artist field?

I get that I can do it by hand but I'd rather not have to comb through thousands of songs haha

Thanks in advance
Logged

JimH

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 72549
  • Where did I put my teeth?
Re: Filling custom tag using data from another tag
« Reply #1 on: May 03, 2017, 05:56:31 am »

Welcome to the forum.  You can probably do it with MC's Expression language. 

https://wiki.jriver.com/index.php/Expression_Language

You can use an expression in the field directly.
Logged

blgentry

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 8014
Re: Filling custom tag using data from another tag
« Reply #2 on: May 03, 2017, 06:19:59 am »

This is kind of a complicated task, but it can be done.  Luckily there's been some discussion about this previously.  I just spent 10 minutes building on some older work in a thread here:

https://yabb.jriver.com/interact/index.php?topic=103648.0

I've come up with something that extracts the "featuring" information from both Artist and Name fields and outputs them.  I may not have covered all of the cases in the linked thread, as I used connersaw's expressions from the middle of the thread.  So I may have more work to do on this to really make it work well.  But as a starter, to show you what it can do, let's try this expression:

Go to album listing and right click on the column headers.  Choose "add expression column".  In the dialog that pops up, give it a title.  Then, in the expression area below, paste in this:

Code: [Select]
listcombine(replace(replace(replace(replace(replace(regex([Artist],/#(.+)\s+\(*(featuring|feat|ft)\.*\s+([^\)]+)\)*$#/,-1,0)[R3],/,,;),&,;),and,;),/ ;,;),/; ,;) , replace(replace(replace(replace(replace(regex([Name],/#(.+)\s+\(*(featuring|feat|ft)\.*\s+([^\)]+)\)*$#/,-1,0)[R3],/,,;),&,;),and,;),/ ;,;),/; ,;))
This should catch a lot of your "feat, featuring" etc cases. 

Let me know how it works.

Brian.
Logged

Wavry

  • Recent member
  • *
  • Posts: 5
Re: Filling custom tag using data from another tag
« Reply #3 on: May 03, 2017, 08:50:51 am »

This is kind of a complicated task, but it can be done.  Luckily there's been some discussion about this previously.  I just spent 10 minutes building on some older work in a thread here:

https://yabb.jriver.com/interact/index.php?topic=103648.0

I've come up with something that extracts the "featuring" information from both Artist and Name fields and outputs them.  I may not have covered all of the cases in the linked thread, as I used connersaw's expressions from the middle of the thread.  So I may have more work to do on this to really make it work well.  But as a starter, to show you what it can do, let's try this expression:

Go to album listing and right click on the column headers.  Choose "add expression column".  In the dialog that pops up, give it a title.  Then, in the expression area below, paste in this:

Code: [Select]
listcombine(replace(replace(replace(replace(replace(regex([Artist],/#(.+)\s+\(*(featuring|feat|ft)\.*\s+([^\)]+)\)*$#/,-1,0)[R3],/,,;),&,;),and,;),/ ;,;),/; ,;) , replace(replace(replace(replace(replace(regex([Name],/#(.+)\s+\(*(featuring|feat|ft)\.*\s+([^\)]+)\)*$#/,-1,0)[R3],/,,;),&,;),and,;),/ ;,;),/; ,;))
This should catch a lot of your "feat, featuring" etc cases. 

Let me know how it works.

Brian.

Thanks for the reply Brian! It works to an extent, it pulls all the information from both the Artist and Name fields, but it doesn't remove the data from the Artist and Name fields, would that be possible or too complicated?

Also the data entered into the calculated field is always suffixed with an ellipsis, is this normal?
Logged

blgentry

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 8014
Re: Filling custom tag using data from another tag
« Reply #4 on: May 03, 2017, 09:46:00 am »

Thanks for the reply Brian! It works to an extent, it pulls all the information from both the Artist and Name fields, but it doesn't remove the data from the Artist and Name fields, would that be possible or too complicated?

That's possible, but more complicated.  I'm not 100% sure, but I can play with it some later when I have more time.  This really becomes kind of a data cleanup and manipulation task, as opposed to an alternate display or something.

Quote
Also the data entered into the calculated field is always suffixed with an ellipsis, is this normal?

No, that normally indicates that there's a formatting issue.  Usually a trailing newline character or something.  Note that the expression I provided produces a List.  The list is a semicolon (;) separated list of artists, as there may be more than one featured artist per track.  I had one in my collection with 5 featured artists on one track.  It's possible that  your calculated data type is not set to list and that's what's confusing it.  I don't have time to test it right now; just giving you some info to experiment with.

Good luck.

Brian.
Logged

Wavry

  • Recent member
  • *
  • Posts: 5
Re: Filling custom tag using data from another tag
« Reply #5 on: May 03, 2017, 09:55:58 am »

It's possible that  your calculated data type is not set to list and that's what's confusing it.  I don't have time to test it right now; just giving you some info to experiment with.

Good luck.

Brian.

Thanks again Brian, don't worry about doing it, I don't expect all the work to be done for me haha, just this is very new to me so it's nice to get a few pointers, really appreciate the help
Logged

blgentry

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 8014
Re: Filling custom tag using data from another tag
« Reply #6 on: May 03, 2017, 04:50:39 pm »

First, cleaning the Artist and Name fields to remove the "featuring" information.  Here are two new expressions for you:

Name Cleaned:
Code: [Select]
regex([Name],/#(.+)\s+\(*(featuring|feat|ft)\.*\s+([^\)]+)\)*#/,-1,0)[R1]
Artist Cleaned:
Code: [Select]
regex([Artist],/#(.+)\s+\(*(featuring|feat|ft)\.*\s+([^\)]+)\)*#/,-1,0)[R1]
Try those out as expression columns and see if they give you good results.  They worked on nearly all of my cases.

Brian.
Logged

blgentry

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 8014
Re: Filling custom tag using data from another tag
« Reply #7 on: May 03, 2017, 04:55:18 pm »

For your ellipsis problem:  I tried putting my expression into a calculated field of type String and it just worked.  No ellipsis in any of my cases.  I may not have the right cases.

Does my expression work correctly for you in an expression column?  If so, you should be able to cut and paste that into a calculated data field and make it work.

Good luck,

Brian.
Logged

Wavry

  • Recent member
  • *
  • Posts: 5
Re: Filling custom tag using data from another tag
« Reply #8 on: May 03, 2017, 06:26:34 pm »

Just reopened JRiver and all the ellipses are gone, don't know how, but that's good.
Thanks for the code, but it only seems to work when there's a featured artist, for any tracks with a single artist it stays blank.

First, cleaning the Artist and Name fields to remove the "featuring" information.  Here are two new expressions for you:

Name Cleaned:
Code: [Select]
regex([Name],/#(.+)\s+\(*(featuring|feat|ft)\.*\s+([^\)]+)\)*#/,-1,0)[R1]
Artist Cleaned:
Code: [Select]
regex([Artist],/#(.+)\s+\(*(featuring|feat|ft)\.*\s+([^\)]+)\)*#/,-1,0)[R1]
Try those out as expression columns and see if they give you good results.  They worked on nearly all of my cases.

Brian.
Logged

blgentry

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 8014
Re: Filling custom tag using data from another tag
« Reply #9 on: May 03, 2017, 07:10:30 pm »

Just reopened JRiver and all the ellipses are gone, don't know how, but that's good.
Thanks for the code, but it only seems to work when there's a featured artist, for any tracks with a single artist it stays blank.

That's correct.  I think I could alter the expression pretty easily to fix that.  I'm pretty tired right now. I'll try to remember to spend 5 minutes on this first thing in the morning.

Brian.
Logged

Wavry

  • Recent member
  • *
  • Posts: 5
Re: Filling custom tag using data from another tag
« Reply #10 on: May 03, 2017, 07:13:38 pm »

Haha no please don't go out of your way any more, you've helped so much, I'm going to read up about expressions and see if I can figure it out, thanks a lot man.
Logged

blgentry

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 8014
Re: Filling custom tag using data from another tag
« Reply #11 on: May 04, 2017, 06:06:57 am »

Ok, have fun with the expression language.  It's a really powerful and great feature of MC.

If you end up needing help, I think I have this one figured out.

Good luck!

Brian.
Logged
Pages: [1]   Go Up