INTERACT FORUM

Please login or register.

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

Author Topic: Removing "Junk" from Lyrics after Lookup Lyrics  (Read 1769 times)

mvandyke

  • World Citizen
  • ***
  • Posts: 159
Removing "Junk" from Lyrics after Lookup Lyrics
« on: June 13, 2021, 07:41:22 am »

I updated some lyrics yesterday and found that JRiver did bring in the lyrics but also brought in a lot of other "junk".  See attached file for an example. I've seen this a lot using JRiver lookup lyrics but the <span as been at the begging of the file.

I have about 300 songs that I need to remove the bad data.  I've looked that the expressions language and did a little testing with no success.

What expression could I use to remove everything from <span to the end of the file.

Thanks
Matt
Logged

SMU2027

  • Recent member
  • *
  • Posts: 9
Re: Removing "Junk" from Lyrics after Lookup Lyrics
« Reply #1 on: June 13, 2021, 08:15:36 am »

I hit rename and delete which did the trick.
Logged

mvandyke

  • World Citizen
  • ***
  • Posts: 159
Re: Removing "Junk" from Lyrics after Lookup Lyrics
« Reply #2 on: June 13, 2021, 09:07:19 am »

I hit rename and delete which did the trick.

That removes everything from the Lyric and I would like to keep the good part of it.  I have almost 300 files that need to be touched so I would like to use an expression to clear out everything from <span to the end and keep the good part of the lyrics.

Thanks
Matt
Logged

Matt

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 42376
  • Shoes gone again!
Re: Removing "Junk" from Lyrics after Lookup Lyrics
« Reply #3 on: June 13, 2021, 10:10:20 am »

What's the artist, album and name for a file pulling extra data?  We'll try to clean it up.  Thanks.
Logged
Matt Ashland, JRiver Media Center

mvandyke

  • World Citizen
  • ***
  • Posts: 159
Re: Removing "Junk" from Lyrics after Lookup Lyrics
« Reply #4 on: June 13, 2021, 02:37:28 pm »

Please see attached CSV file for more details.  Sorted by Artist and then Album.

Oops CSV not allowed - here are a couple of print screens.

Although the lyrics appear OK at first glance they all have 5+ lines of "junk" in them that all start with <span.

Would still be great to know the way to remove this data (for potential future issues) with an expression.

Thanks
Matt
Logged

zybex

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2619
Re: Removing "Junk" from Lyrics after Lookup Lyrics
« Reply #5 on: June 14, 2021, 02:59:06 am »

You can use
=regex([lyrics],/#(.+?)<span#/,1)
Logged

mvandyke

  • World Citizen
  • ***
  • Posts: 159
Re: Removing "Junk" from Lyrics after Lookup Lyrics
« Reply #6 on: June 14, 2021, 08:26:31 am »

You can use
=regex([lyrics],/#(.+?)<span#/,1)


I copied that expression to a new expression field and I could not get it to work.  I tried a couple of adjustments but REGEX has always been a challenge for me.

There is always a space after <span and I tried /s but could not get it to work.

Here is a typical section of good Lyrics and then <span "Junk"

Well, you tell me men don't have much intuition
Is that what you really thinking girl
Or are you wishing
Before you wreck your old home
And search for another new
Dadgummit
Who is he, and what is he to you
Dadgummit
Who is he, and what is he to you
Dadgummit
Who is he, and what is he to you
Dadgummit
Who is he, and what is he to you
<span jsname="Bil8Ae" class="xTFaxe z1asCe SaPW2b" style="height:18px;line-height:18px;width:18px"><svg focusable="false" xmlns="http://www.w3.org/2000/svg" viewbox="0 0 24 24"><path d="M12 8c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"></path></svg>
<span jsname="Bil8Ae" class="xTFaxe z1asCe SaPW2b" style="height:18px;line-height:18px;width:18px"><svg focusable="false" xmlns="http://www.w3.org/2000/svg" viewbox="0 0 24 24"><path d="M12 8c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"></path></svg>
<span jsname="Bil8Ae" class="xTFaxe z1asCe SaPW2b" style="height:18px;line-height:18px;width:18px"><svg focusable="false" xmlns="http://www.w3.org/2000/svg" viewbox="0 0 24 24"><path d="M12 8c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"></path></svg>
<span jsname="Bil8Ae" class="xTFaxe z1asCe SaPW2b" style="height:18px;line-height:18px;width:18px"><svg focusable="false" xmlns="http://www.w3.org/2000/svg" viewbox="0 0 24 24"><path d="M12 8c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"></path></svg>
<span jsname="Bil8Ae" class="xTFaxe z1asCe SaPW2b" style="height:18px;line-height:18px;width:18px"><svg focusable="false" xmlns="http://www.w3.org/2000/svg" viewbox="0 0 24 24"><path d="M12 8c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"></path></svg>
Logged

Dawgincontrol

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 679
  • We have met the enemy and he is us.
Re: Removing "Junk" from Lyrics after Lookup Lyrics
« Reply #7 on: June 14, 2021, 08:30:29 am »

Simplest and easiest way.

Go to "Tag".  Scroll down under "Advanced>Lyrics.  Click on the Lyric box and edit what you don't want out.  You can also fix incorrect lyrics in this manner. 

It will also let you edit in a pop-up window if you want.
Logged

Matt

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 42376
  • Shoes gone again!
Re: Removing "Junk" from Lyrics after Lookup Lyrics
« Reply #8 on: June 14, 2021, 08:38:38 am »

MC28 will try to correct the issue you found.  Thank you.
Logged
Matt Ashland, JRiver Media Center

SkGe

  • Galactic Citizen
  • ****
  • Posts: 433
Re: Removing "Junk" from Lyrics after Lookup Lyrics
« Reply #9 on: June 14, 2021, 09:06:36 am »

@ Matt
Can I add some notes about this and maybe insert a request for a way to fix some issue with fields which are large format. Ex. Comment and lyrics. I am using an program to import lyrics inside MC, when this program find the lyrics it will add to MC. As of that sometimes the lyrics have additional information which I'm trying to figure out a way to remove it. I find a way in MC to do this but I have to use multiple expression to help me removing those unnecessary text but is not quite the ideal. The other way which is tedious, is to do it manually which takes time and I will try to avoid that.
I have this example:
https://regex101.com/r/Nh4GGJ/2
Where I can use this regex method to find the text which I desire to remove but to use this in MC is not quite possible.
If I want to use it I make this expression =regex([lyrics],/#.?\[.+\]#/,0) where it tell that a lyrics has or not those texts.
How can a regex help, is a way that regex to have a replace method where he can look on the field and then remove the desire information.
regexreplace() where default 0 is to look on the first line and 1 to look on multiple lines. Change with desired information.
regexremove() the same above, with only difference is to remove the unnecessary text.
I'm not so experience with regex method and if someone has a better solution to help or to share a view jump in this chat.
Thanks
Logged

zybex

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2619
Re: Removing "Junk" from Lyrics after Lookup Lyrics
« Reply #10 on: June 14, 2021, 09:11:03 am »

SkGe:
This one should work for you:
Code: [Select]
=replace(regex([Lyrics],/#(?:^|\])\x0A?([^\[]+)#/,-2),;,)
Still, a RegexReplace() would be nice, or even a ListReplace() to be used with Regex mode -2:
ListReplace(string, searchList, replacementList)
Logged

SkGe

  • Galactic Citizen
  • ****
  • Posts: 433
Re: Removing "Junk" from Lyrics after Lookup Lyrics
« Reply #11 on: June 14, 2021, 09:28:34 am »

@ zybex
It works partially, but now it creates multiple empty lines, and if I use trimlines() to remove that it will break the lyrics format. It will make a line of texts and no space. I will try to have a look there and see a way to keep the empty lines untouched.
Logged

SkGe

  • Galactic Citizen
  • ****
  • Posts: 433
Re: Removing "Junk" from Lyrics after Lookup Lyrics
« Reply #12 on: June 14, 2021, 09:30:53 am »

@ mvandyke sorry if I steal your post but maybe it can help us both :P
Logged

zybex

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2619
Re: Removing "Junk" from Lyrics after Lookup Lyrics
« Reply #13 on: June 14, 2021, 09:54:33 am »

@SkGe, that's likely due to CRLF instead of just LF. Try this:
Code: [Select]
=trim(replace(regex([Lyrics],/#(?:^|\])[\r\n]*([^\[]+)#/,-2),;,))
Logged

zybex

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2619
Re: Removing "Junk" from Lyrics after Lookup Lyrics
« Reply #14 on: June 14, 2021, 10:49:46 am »

I copied that expression to a new expression field and I could not get it to work.  I tried a couple of adjustments but REGEX has always been a challenge for me.
That's funny, it worked for me when I first tested it, but now it doesn't - this is again due to the line endings, I think.
Here's an alternative which I don't like that much, but should work:
Code: [Select]
=regex([lyrics],/#([^<]+)<span#/,1)
@Matt:
- It looks like "." doesn't match line endings. Would it break anything if you enabled the Regex SingleLine flag by default? If not, is there a way to enable it on the Regex() parameter itself? "(?s)" doesn't work.
- "((.|\r|\n)+)" should match an entire multiline string like the lyrics above, but it doesn't. Is it a bug, or am I missing something?
Logged

mvandyke

  • World Citizen
  • ***
  • Posts: 159
Re: Removing "Junk" from Lyrics after Lookup Lyrics
« Reply #15 on: June 16, 2021, 11:24:59 am »

Thanks Zybex - that last one worked just fine!
Logged
Pages: [1]   Go Up