Author Topic: LyricsReloaded (Updated)  (Read 164130 times)

frankz

  • Sr. Member
  • ****
  • Posts: 3835
Did you enable the additional providers in your MB settings?

heyman111

  • Jr. Member
  • **
  • Posts: 46
Did you enable the additional providers in your MB settings?

I only want to use Genius (even if it doesn't find any) so this is what I have on my settings:

frankz

  • Sr. Member
  • ****
  • Posts: 3835
That looks right you should look in the plug-in's log file in your AppData folder (the exact file location is in this thread I don't have it right now) and see what URL the plug-in is constructing for this search and then see if it matches the actual URL for the lyrics on genius (assuming they're there).  Also look for any other indication why it's not pulling them down.  It's possible they changed something.

EDIT: Uh oh.  Looks like they changed the format of their lyrics, at least when there are a lot of notes. Still starts with song_body-lyrics so something should happen though.
Last Edit: October 24, 2020, 08:14:43 PM by frankz

heyman111

  • Jr. Member
  • **
  • Posts: 46
That looks right you should look in the plug-in's log file in your AppData folder (the exact file location is in this thread I don't have it right now) and see what URL the plug-in is constructing for this search and then see if it matches the actual URL for the lyrics on genius (assuming they're there).  Also look for any other indication why it's not pulling them down.  It's possible they changed something.

EDIT: Uh oh.  Looks like they changed the format of their lyrics, at least when there are a lot of notes. Still starts with song_body-lyrics so something should happen though.

Yeah I picked The Weeknd because he's the most mainstream artist I have, and all his lyrics are on genius. Here is the log file when I try to play "Can't Feel My Face":
Quote
24-10-2020 10:41:03 [DEBUG] Lyrics request: The Weeknd - Can't Feel My Face - Beauty Behind the Madness - Genius
24-10-2020 10:41:03 [INFO] Genius tries to load the lyrics...
24-10-2020 10:41:03 [DEBUG] The constructed URL: http://genius.com/the-weeknd-cant-feel-my-face-lyrics
24-10-2020 10:41:07 [DEBUG] gzip compression detected
24-10-2020 10:41:07 [WARN] The pattern <div\s+class="song_body-lyrics"[^>]*?>[\s\S]*?<p>(?<lyrics>[\s\S]*?)</p> didn't match!
24-10-2020 10:41:07 [INFO] No lyrics found.
24-10-2020 10:41:07 [DEBUG] no lyrics found from Genius

frankz

  • Sr. Member
  • ****
  • Posts: 3835
Hmm...this is not good.  I think if I change the match pattern from this:
Code
pattern: ['<div\s+class="song_body-lyrics"[^>]*?>[\s\S]*?<p>(?<lyrics>[\s\S]*?)</p>', s]

...to this...
Code
pattern: ['<div\s+class="song_body-lyrics"[^>]*?>[\s\S]*?(?<div\s+class="lyrics">[\s\S]*?)</div>', s]

...or something, then I can probably get rid of the error, but I don't think with everything that's going on around the actual text of the lyrics it'll work anyway.

Here's everything that happens between when it hits the match pattern and when the text of the lyrics starts

Code
    <div class="song_body-lyrics">
      
        <h2 class="text_label text_label--gray text_label--x_small_text_size u-top_margin">Tell Your Friends Lyrics</h2>
      
      <div initial-content-for="lyrics">
        <div class="lyrics">
          
            <!--sse-->
            <p><a href="/The-weeknd-tell-your-friends-lyrics#note-7670658" data-id="7670658" class="referent" ng-click="open()" ng-class="{
          'referent--linked_to_preview': song_ctrl.referent_has_preview(fragment_id),
          'referent--linked_to_preview_active': song_ctrl.highlight_preview_referent(fragment_element_id),
          'referent--purple_indicator': song_ctrl.show_preview_referent_indicator(fragment_element_id)
        }" prevent-default-click="" annotation-fragment="7670658" on-hover-with-no-digest="set_current_hover_and_digest(hover ? fragment_id : undefined)" classification="accepted" image="false" pending-editorial-actions-count="0">

Every line or block of text has that kind of mess in it.

Genius may be hosed unless anyone has any ideas.  Here's are the filters for it.

Code
post-filters:
- strip_html
- clean_spaces
- utf8_encode
- [regex, 'googletag.*\);', "\n"]
- [regex, '\[.{1,75}\]', ""]
- [regex, "’", "'"]
- [replace, "\n\n", "\n"]
- trim

It might be possible, but if it is, it's beyond my abilities to figure the RegEx out.  It took every working cell in my brain to come up with this to strip the section headers.  :)

Code
- [regex, '\[.{1,75}\]', ""]

sveakul

  • Sr. Member
  • ****
  • Posts: 2438
Man that's a drag all right, Genius produced the vast majority of my hits from available providers.  Can ANYONE please help frankz (and therefore ALL of us) out with this??

Steven

  • Administrator
  • Sr. Member
  • *****
  • Posts: 34313
I have used the following in the past to strip out html tags in case it helps with this issue
Code
Regex.Replace(value, "<.*?>", "")

frankz

  • Sr. Member
  • ****
  • Posts: 3835
That might be what "- strip_html" does.  I'll try to update the match and test it locally to see what happens.

frankz

  • Sr. Member
  • ****
  • Posts: 3835
Pretty sure I got it licked!  Thanks to Steven for putting me in the right direction and to biggy_wayn for noticing the problem.  Updating the OP now, new version is already on Github.

phred

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 9305
Updating the OP now, new version is already on Github.
And thanks to you for getting the fix out there so quickly.
Download the latest MusicBee v3.5 or 3.6 patch from here.
Unzip into your MusicBee directory and overwrite existing files.

----------
The FAQ
The Wiki
Posting screenshots is here
Searching the forum with Google is  here

heyman111

  • Jr. Member
  • **
  • Posts: 46
Works now, excellent job Frankz and Steven. This plugin will save me hours of time.

frankz

  • Sr. Member
  • ****
  • Posts: 3835
Glad I could fix it rather than delete it.  The original plugin author had already scripted the strip html thing but it took a shove in the right direction from Steven for me to open my eyes and actually see it. 

sveakul

  • Sr. Member
  • ****
  • Posts: 2438

frankz

  • Sr. Member
  • ****
  • Posts: 3835
Not a problem. My hurdle was getting out of my comfort zone for a few minutes to experiment.

lucytea

  • Newbie
  • *
  • Posts: 7
Hi, new here.
I've noticed that when this plugin fetches lyrics from Genius it seems to strip the paragraph breaks, then convert the [labels] to paragraph breaks.
Is this something that could possibly be made configurable? I think it would be more readable the way Genius presents it.
Apologies if this isn't viable, thanks for the cool plugin anyway.