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

sveakul

  • Hero Member
  • *****
  • Posts: 1907
Is there a way to remove [Intro], [Chorus], [Verse], etc ?
If you mean from Genius, the code at the post below already does that, thanks to a mod by frankz:
https://getmusicbee.com/forum/index.php?topic=25406.msg198321#msg198321

RetroGameReaper

  • Newbie
  • *
  • Posts: 9
Is there a way to make it so the script can read
Code
’ ( )
signs? I don't know how to make my own script since YAML is new to me. I took a script from here
Code
name: Genius (2022-1-27)

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["]
- [regex, '\n{2,}',"\n\n", 's']
- trim

This is the log file when using tracks with an apostrophe and parenthesis:
Code
18/04/2022 08:28:06 [DEBUG] Lyrics request: Andrew Jackson Jihad - We Didn’t Come Here To Rock - Can’t Maintain - Genius (2022-1-27)
18/04/2022 08:28:06 [INFO] Genius (2022-1-27) tries to load the lyrics...
18/04/2022 08:28:06 [DEBUG] The constructed URL: https://genius.com/andrew-jackson-jihad-we-didn-t-come-here-to-rock-lyrics
18/04/2022 08:28:06 [INFO] No lyrics found.
18/04/2022 08:28:06 [DEBUG] no lyrics found from Genius (2022-1-27)
18/04/2022 08:28:23 [DEBUG] Lyrics request: Andrew Jackson Jihad - Olde(y) Tyme - Can’t Maintain - Genius (2022-1-27)
18/04/2022 08:28:23 [INFO] Genius (2022-1-27) tries to load the lyrics...
18/04/2022 08:28:23 [DEBUG] The constructed URL: https://genius.com/andrew-jackson-jihad-olde-y-tyme-lyrics
18/04/2022 08:28:23 [INFO] No lyrics found.
18/04/2022 08:28:23 [DEBUG] no lyrics found from Genius (2022-1-27)
18/04/2022 08:28:39 [DEBUG] Lyrics request: Andrew Jackson Jihad - Kazoo Sonata In Cmaj - Can’t Maintain - Genius (2022-1-27)
18/04/2022 08:28:39 [INFO] Genius (2022-1-27) tries to load the lyrics...
18/04/2022 08:28:39 [DEBUG] The constructed URL: https://genius.com/andrew-jackson-jihad-kazoo-sonata-in-cmaj-lyrics
18/04/2022 08:28:40 [DEBUG] gzip compression detected
18/04/2022 08:28:40 [WARN] The pattern <div data-lyrics-container="true" class="Lyrics__Container-sc-1ynbvzw-6 jYfhrf">(?<lyrics>.*)<div class="Lyrics__Footer-sc- didn't match!
18/04/2022 08:28:40 [INFO] No lyrics found.
18/04/2022 08:28:40 [DEBUG] no lyrics found from Genius (2022-1-27)
18/04/2022 08:34:03 [DEBUG] Received a notification of type TagsChanging
18/04/2022 08:35:16 [DEBUG] Received a notification of type TagsChanging
18/04/2022 08:39:05 [DEBUG] Received a notification of type TagsChanging
18/04/2022 08:44:43 [DEBUG] Lyrics request: Aimee Mann - That’s Just What You Are - I’m With Stupid - Genius (2022-1-27)
18/04/2022 08:44:43 [INFO] Genius (2022-1-27) tries to load the lyrics...
18/04/2022 08:44:43 [DEBUG] The constructed URL: https://genius.com/aimee-mann-that-s-just-what-you-are-lyrics
18/04/2022 08:44:44 [INFO] No lyrics found.
18/04/2022 08:44:44 [DEBUG] no lyrics found from Genius (2022-1-27)

I noticed that for songs with an apostrophe, Genius ignores the sign in the URL. Ex: That’s Just What You Are --> https://genius.com/Aimee-mann-thats-just-what-you-are-lyrics
The same goes for parenthess: Olde(y) Tyme(y) --> https://genius.com/Ajj-oldey-tymey-lyrics

Crash

  • Newbie
  • *
  • Posts: 6
I just clean install Musicbee, new pc, and I'm a bit lost...
On my old install I had so many plugins and I have rewrite all the code on every config files...
I don't want to use all my old config .ini, too old, I even had old custom plugins like Ipod autosync, lastfm things, minilyrics...
Was it from winamp ? Idk, I don't use my ipod 160go anymore  ;D
I use Tidal with Roon Labs... But that's not the point.
When I'm gaming or partying I prefer Musicbee  :-*

So I clean install musicbee, I use some of my MusicBeeLibrarySettings.ini and skins config, looks nice and organise !

I just miss auto lyrics display..
And, sorry, I don't feel like reading all this topic :s

So, maybe we need an abstract, a TLDR,  how how to configure this shit ? Where to download ?

Ps: I still have my old files for perfect auto-lyrics and all, just wanna do a clean install.

hiccup

  • Hero Member
  • *****
  • Posts: 5932
And, sorry, I don't feel like reading all this topic :s
So, maybe we need an abstract, a TLDR,  how how to configure this shit ? Where to download ?
read post #1

Newbee22

  • Newbie
  • *
  • Posts: 5
Hello,

I created a thread about this in Questions and was pointed here. I can confirm I have it [mostly] working now, so thank you for that! However although this now works great for more mainstream songs, where the internet is full of lyrics for them, it still isn't working properly.

For example I searched google for 'jewel half life lyrics' and the first one that comes up is the full set of lyrics from Musixmatch. Another is the song by Stars called To Feel What They Feel, these lyrics are on Genius I'm looking at them right now, but again not showing in my Lyrics panel of MB it just says "No lyrics found". Clicking Redo Search multiple times makes no difference.

When I go to Preferences > Tags (2) > Lyrics I have selected 3 and ordered them as so:

1. Musixmatch; 2. Genius; 3. A-Z Lyrics Universe

I have also tried with only 1 and 2 selected above.

Don't get me wrong, I am glad to have lyrics working for some songs now rather than none, but is there anybody that can help me fix this so that it works flawlessly like it used to?

sveakul

  • Hero Member
  • *****
  • Posts: 1907
The first place to start is to make sure you are using the updated versions of the yml files corresponding to the selected search sites.  You can find these posted elsewhere within this thread, but for the heckuvit I will post them here.  You need to copy the code from the box, and paste that individually into text files renamed with the *yml extenson, like "genius.yml," and then put those into the folder "C:\MusicBee\AppData\mb_LyricsReloaded\providers" (example path is with Portable version, will vary with Installer version and is a no-go with Store version).  Restart MusicBee if it wasn't closed.  Then, select those versions in Prefs/Tags(2)/lyrics/Lyrics Providers ("..." button).  Note that the name on the selection list will correspond to the name on the first code line "name:," not the yml filename itself if those are different.  Then, choose "Update", and Save.  This is all easier than it sounds.

Genius:

Code
name: Genius (2022-1-27)

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

AZLyrics:

Code
name: A-Z Lyrics Universe

variables:
    artist:
        type: artist
        filters:
        - lowercase
        - strip_nonascii
    title:
        type: title
        filters: artist

headers:
    User-Agent: 'Mozilla/5.0 (Windows NT 6.3; WOW64; rv:30.0) Gecko/20100101 Firefox/30.0' # Firefox 30 Win x64 user agent

config:
    url: "http://www.azlyrics.com/lyrics/{artist}/{title}.html"
    pattern: ['<!-- Usage of azlyrics.com content by any third-party lyrics provider is prohibited by our licensing agreement. Sorry about that. -->(?<lyrics>.+?)<!-- MxM banner -->', s]
    
post-filters:
- strip_html
- trim
- utf8_encode

Musixmatch:

Code
name: Musixmatch-new

variables:
    artist:
        type: artist
        filters:
        - strip_diacritics
        - lowercase
        - [regex, "'", ""]
        - [regex, "/", " "]
        - [regex, '\s&(?=\s)', " "]
        - [regex, '(?<=\W|\s)+(feat.+|ft[\W\s]+|(f\.\s)).+', ""]
        - [regex, '[^\sa-z0-9]\s*', ""]
        - [strip_nonascii, -]
    title:
        type: title
        filters:
        - strip_diacritics
        - lowercase
        - [regex, " '|' |/", " "]
        - [regex, "'", " "]
        - [regex, '\.+|,+|/+|(\W+(?=$))|(^\W+)', ""]
        - [regex, '\s&(?=\s)', " and"]
        - [strip_nonascii, -]

config:
    url: "http://www.musixmatch.com/lyrics/{artist}/{title}"
    pattern: ['<p class="mxm-lyrics__content.*?">(?<lyrics>.*?)<div [^>]*"lyrics-report".*?>', s]

post-filters:
- [regex, "<script.*?</script>", "", s]
- strip_html
- utf8_encode
- entity_decode
- clean_spaces

The built-in Song Lyrics code also works fine for me as-is, select it also as it has stuff others do not.  The rest are "feel free to try."
Last Edit: May 29, 2022, 09:57:07 PM by sveakul

Newbee22

  • Newbie
  • *
  • Posts: 5
Thank you for the above, that's really helpful.

I've followed all of the steps. I'm now looking in the logs (AppData\Roaming\MusicBee\mb_LyricsReloaded) and can see the error it's getting - are you able to tell me in layman terms what might be going wrong and how I can fix it?

29/05/2022 09:06:05 [DEBUG] Lyrics request:  - Jewel - Half Life - Freewheelin' Woman - Genius
29/05/2022 09:06:05 [INFO] Genius tries to load the lyrics...
29/05/2022 09:06:05 [DEBUG] The constructed URL: http://genius.com/jewel-half-life-lyrics
29/05/2022 09:06:05 [DEBUG] Lyrics request:  - Jewel - Half Life - Freewheelin' Woman - Musixmatch
29/05/2022 09:06:05 [INFO] Musixmatch tries to load the lyrics...
29/05/2022 09:06:05 [DEBUG] The constructed URL: http://www.musixmatch.com/lyrics/jewel/half-life
29/05/2022 09:06:05 [DEBUG] Lyrics request:  - Jewel - Half Life - Freewheelin' Woman - A-Z Lyrics Universe
29/05/2022 09:06:05 [INFO] A-Z Lyrics Universe tries to load the lyrics...
29/05/2022 09:06:05 [DEBUG] The constructed URL: http://www.azlyrics.com/lyrics/jewel/halflife.html
29/05/2022 09:06:05 [DEBUG] gzip compression detected
29/05/2022 09:06:05 [WARN] The pattern <!-- start of lyrics -->(?<lyrics>.+?)<!-- end of lyrics --> didn't match!
29/05/2022 09:06:05 [INFO] No lyrics found.
29/05/2022 09:06:05 [DEBUG] no lyrics found
29/05/2022 09:06:05 [DEBUG] gzip compression detected
29/05/2022 09:06:05 [DEBUG] lyrics found
29/05/2022 09:06:05 [DEBUG] gzip compression detected
29/05/2022 09:06:05 [WARN] The pattern <div\s+class="song_body-lyrics"[^>]*?>[\s\S]*?<p>(?<lyrics>[\s\S]*?)</p> didn't match!
29/05/2022 09:06:05 [INFO] No lyrics found.
29/05/2022 09:06:05 [DEBUG] no lyrics found

Newbee22

  • Newbie
  • *
  • Posts: 5
UPDATE: One thing I've noticed is that in Lyrics Providers panel of Preferences I don't have Genius (2022-1-27) I just have Genius, same with I have Musixmatch but I do not see Musixmatch-new could this be my problem?

I definitely have the YML files in the correct place so not sure why they're not being picked up.

Newbee22

  • Newbie
  • *
  • Posts: 5
BETTER UPDATE !!

I just rebooted and they appeared in the list, and it's now working perfectly.

Thank you so much - this is great!  :D

sveakul

  • Hero Member
  • *****
  • Posts: 1907
OK, glad it's working for you.  I assumed the yml file additions would be made with MusicBee closed;  have updated the instructions thanks to your input.

Tybot

  • Sr. Member
  • ****
  • Posts: 287
Anyone else having issues with line breaks being removed or inserted?

This one is not a plugin issue, but Musixmatch has done this for a while. When copying the lyrics from their site, a line break gets inserted at the 4th line, which usually separates the last line of the first verse from the previous ones which results in this:

line1
line2
line3

line4

line5
line6

No idea why...

Lately, though, this plugin along with the latest Genius yml started to remove line breaks from a lot of songs. Copying them manually from the web works fine, but not when using the plugin. The exact opposite of the issue described above with Musixmatch in other words.

Apologies for using a Swedish example, but here's the most recent experience I had with this. Line break between 2nd and 3rd verse is removed whenever the plugin is being used to fetch the lyrics: https://genius.com/Sakert-far-jag-lyrics

Using ublock origin on the Genius site reveals a container called PrimisPlayer, located between the above mentioned verses, which I assume has something to do with this.

frankz

  • Hero Member
  • *****
  • Posts: 3166
I started feeling bad that everyone had worked so hard updating these scripts and that sveakul kept having to tell people how to use them, so I updated the plugin one last time:

https://github.com/mbfrankz/LyricsReloaded/releases/tag/1.1.11

This includes the three scripts posted a couple of posts above.  I didn't change or remove anything else because I'm no longer sure what works and what doesn't.
A smile is happiness you'll find right under your nose.

hiccup

  • Hero Member
  • *****
  • Posts: 5932
This includes the three scripts posted a couple of posts above.
Thanks (again) frankz!

Perhaps I am doing something wrong, but could it be that A-Z Lyrics is missing?

frankz

  • Hero Member
  • *****
  • Posts: 3166
This includes the three scripts posted a couple of posts above.
Thanks (again) frankz!

Perhaps I am doing something wrong, but could it be that A-Z Lyrics is missing?
You're not doing anything wrong.  I think I forgot how to add providers.  I put the yml in but don't remember how to reference it.  I think I can remember if I put a little time behind it - standby for 1.1.12 tonight or tomorrow.  Sorry - it's what happens when you do something once every two years and were never really solid on it to begin with.
Last Edit: June 01, 2022, 08:35:54 PM by frankz
A smile is happiness you'll find right under your nose.

hiccup

  • Hero Member
  • *****
  • Posts: 5932
standby for 1.1.12 tonight or tomorrow.
Obviously: no pressure, no hurries.
We can only be grateful that somebody is voluntarily making an effort on this stuff to begin with.