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

LazR

  • Jr. Member
  • **
  • Posts: 20
Small change for Genius. With the old '(2021-11-30)' version it just started adding -- 'xxxx Lyrics' to the top so changed the div class where lyrics should start.

If anyone knows how to regex fix there not being a space where ads would appear that would be great.

Code
name: Genius (2022)

variables:
    artist:
        type: artist
        filters:
        - strip_diacritics
        - lowercase
        - [replace, "!!!", "chk-chik-chick"]
        - [regex, '(?<=\W|\s)+(feat.+|ft[\W\s]+|(f\.\s)).+', ""]
        - [regex, '\.+|,+|(\W+(?=$))|(^\W+)', ""]
        - [regex, "'", ""]
        - [regex, '(?<=[a-z0-9%])[^\sa-z0-9%]+(?=[a-z0-9%]+)', "-"]
        - [regex, '((?<=\s)([^a-z0-9\s-])+(\s|\W)+)|((?<=\w)([^a-z0-9-])+(\s|\W)+)', " "]
        - [strip_nonascii, -]
    title:
        type: title
        filters: artist

config:
    url: "https://genius.com/{artist}-{title}-lyrics"
    pattern: ['<div data-lyrics-container="true" class="Lyrics__Container-sc-1ynbvzw-6 jYfhrf">(?<lyrics>.*)<div class="Lyrics__Footer-sc-', 's']

post-filters:
- br2nl
- strip_html
- utf8_encode
- entity_decode
- clean_spaces
- [regex, '\n{2,}',"\n\n", 's']
- trim

sveakul

  • Sr. Member
  • ****
  • Posts: 2438
Small change for Genius. With the old '(2021-11-30)' version it just started adding -- 'xxxx Lyrics' to the top so changed the div class where lyrics should start.
Thanks LazR for the working fix!

For those who prefer to keep the "section" type headers out of the lyrics ([refrain], etc) add the code line below above the existing regex expression in the post-filters section:

Code
- [regex, '\[.{1,75}\]', ""]
Remember to re-add Genius after the substitution in the provider hierarchy if keeping the changed "Name" line in LazR's code.  Like him I prefer to keep a date designation there.  Here is the complete code that includes the added regex line mentioned above:

Code
name: Genius (2022)

variables:
    artist:
        type: artist
        filters:
        - strip_diacritics
        - lowercase
        - [replace, "!!!", "chk-chik-chick"]
        - [regex, '(?<=\W|\s)+(feat.+|ft[\W\s]+|(f\.\s)).+', ""]
        - [regex, '\.+|,+|(\W+(?=$))|(^\W+)', ""]
        - [regex, "'", ""]
        - [regex, '(?<=[a-z0-9%])[^\sa-z0-9%]+(?=[a-z0-9%]+)', "-"]
        - [regex, '((?<=\s)([^a-z0-9\s-])+(\s|\W)+)|((?<=\w)([^a-z0-9-])+(\s|\W)+)', " "]
        - [strip_nonascii, -]
    title:
        type: title
        filters: artist

config:
    url: "https://genius.com/{artist}-{title}-lyrics"
    pattern: ['<div data-lyrics-container="true" class="Lyrics__Container-sc-1ynbvzw-6 jYfhrf">(?<lyrics>.*)<div class="Lyrics__Footer-sc-', 's']

post-filters:
- br2nl
- strip_html
- utf8_encode
- entity_decode
- clean_spaces
- [regex, '\[.{1,75}\]', ""]
- [regex, '\n{2,}',"\n\n", 's']
- trim

phred

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 9304
Thanks to both LazR and sveakul for this update.
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

DareNova

  • Newbie
  • *
  • Posts: 1
I noticed when 2 artists work in collaboration, they'd sometimes get a separate page on genius, kinda like this: https://genius.com/artists/Oliver-tree-and-little-big. But the provider made by both LazR and sveakul wouldn't account for this, so I tried fixing this. This seems to work after putting it under the replace already in there
Code
- [replace, "&", "and"]
I don't know if this messes anything else up, but like I said, it seems to work pretty well for me

Another thing I tried doing was trying to get it to recognize "w/ ..." and "+ ..." similar to things like "feat." and "ft."
A good example would be this song: Twikipedia - titles
In my library it is titled "titles 웃 w/ funeral" to keep it similar to it's soundcloud title, but this causes the search to include the "w/" part
Here is the log created by it:
Code
28/01/2022 08:16:52 [DEBUG] Lyrics request: twikipedia - titles 웃 w/ funeral - titles 웃 - Genius
28/01/2022 08:16:52 [INFO] Genius (2022) tries to load the lyrics...
28/01/2022 08:16:52 [DEBUG] The constructed URL: https://genius.com/twikipedia-titles-w-funeral-lyrics
A similar thing happens with titles including "+" as the feat bit, like "medusa +pichu (souls1 & lewisgoing)"

sveakul

  • Sr. Member
  • ****
  • Posts: 2438
I noticed when 2 artists work in collaboration, they'd sometimes get a separate page on genius, kinda like this: https://genius.com/artists/Oliver-tree-and-little-big. But the provider made by both LazR and sveakul wouldn't account for this, so I tried fixing this. This seems to work after putting it under the replace already in there
Code
- [replace, "&", "and"]
I don't know if this messes anything else up, but like I said, it seems to work pretty well for me
Thanks DareNova for this!  I notice that another user "beat you to it", ShotgunStev3 (https://getmusicbee.com/forum/index.php?topic=25406.msg189875#msg189875), but it didn't show up in complete yml posts so far.  Has anyone else been using this as described, and have you noitced any unintended results?  BTW you mentioned me in your "made by" statement, actually I haven't made any personal coding contributions other than re-arranging some lines already made by others.  The honors go to frankz, LaZr, Redearth, crisp, hiccup, and probably others I've missed.

Nayan Nepal

  • Newbie
  • *
  • Posts: 9
Can anyone help me? Whenever I click on search next provider, I only get results from 2 sites : chartlyrics and songlyrics even though I have checked every other boxes. What is wrong?

frankz

  • Sr. Member
  • ****
  • Posts: 3834
The plug-in is seen as one provider by MusicBee no matter how many individual providers you search within the plug-in.  So whichever is the first site to return lyrics within the plug-in, it will always be the one offered up by MusicBee even if other sites from the plug-in also have lyrics.

Nayan Nepal

  • Newbie
  • *
  • Posts: 9
The plug-in is seen as one provider by MusicBee no matter how many individual providers you search within the plug-in.  So whichever is the first site to return lyrics within the plug-in, it will always be the one offered up by MusicBee even if other sites from the plug-in also have lyrics.

So if I disable songlyrics and chartlyrics and only check Genius or any other site that has the lyrics, it should work as usual? Because I think I've encountered a problem with that too as no results show up when both of the aforementioned sites are disabled.

frankz

  • Sr. Member
  • ****
  • Posts: 3834
Each lyrics site native to MusicBee will be seen as an individual site and get cycled through by search next provider. All sites enabled through the plugin will be seen as one provider.  Song Lyrics and Genius are plugin providers. Chart Lyrics is not. 

If you have a specific problem song or songs, you can also just paste the lyrics for that song or those songs into MusicBee. You are not bound to let MusicBee automatically discover them.

Nayan Nepal

  • Newbie
  • *
  • Posts: 9
Each lyrics site native to MusicBee will be seen as an individual site and get cycled through by search next provider. All sites enabled through the plugin will be seen as one provider.  Song Lyrics and Genius are plugin providers. Chart Lyrics is not. 

If you have a specific problem song or songs, you can also just paste the lyrics for that song or those songs into MusicBee. You are not bound to let MusicBee automatically discover them.
I could do it manually, but then what would be the point of installing a plugin in the first place? Thanks for the info anyway.

frankz

  • Sr. Member
  • ****
  • Posts: 3834
I could do it manually, but then what would be the point of installing a plugin in the first place?
Because it works pretty well in most situations. 

Nayan Nepal

  • Newbie
  • *
  • Posts: 9
Well, it works..It's just that I wanted to cycle through lyrics for a song from different sites from just the lyrics window without doing any copy-paste work. I guess chartlyrics and songlyrics will have to do for now. :)

frankz

  • Sr. Member
  • ****
  • Posts: 3834
Well, it works..It's just that I wanted to cycle through lyrics for a song from different sites from just the lyrics window without doing any copy-paste work. I guess chartlyrics and songlyrics will have to do for now. :)
It's hard when the things we download from the internet for free aren't perfect, but it's a burden we must all bear.  ;D

Just wait until you start trying to look at artist pictures!

Nayan Nepal

  • Newbie
  • *
  • Posts: 9
Maybe I'm misremembering but finding lyrics worked flawlessly some years ago for me while cycling through the providers option. As for the artist pictures, I'm just content with getting the lyrics and album artwork tag, so no worries there. At least the album art works almost always.

frankz

  • Sr. Member
  • ****
  • Posts: 3834
Maybe I'm misremembering but finding lyrics worked flawlessly some years ago for me while cycling through the providers option.
I'm sorry this is happening to you.