Author Topic: LyricsReloaded (Latest)  (Read 61630 times)

Mayibongwe

  • Sr. Member
  • ****
  • Posts: 1044
  • Heal The World
Have you checked out this documentation post? https://getmusicbee.com/forum/index.php?topic=25406.msg145769#msg145769
I'll try to come up with a more detailed explanation the coming weekend (breaking down the contents of one or two providers).
For now, here's the basic gist of it:

1. A user needs to have a good understanding of regular expressions.

2. They also need to know the difference between the loaders (static and search).
     Deciding on which one to use is entirely dependent on the structure of the website.

     - The static loader only runs a single web search.
     - The search loader runs two.

e.g
Title: Simple and Clean
Artist: Hikaru Utada

The provider <Genius> has the lyrics for this song on this url: https://genius.com/hikaru-utada-simple-and-clean-lyrics
Here we are able to use the static loader (single search) because we can directly inject the artist and title into the url that leads straight to the lyrics webpage.

..............................

The provider <Deezer> has the lyrics for this song on this url: https://www.deezer.com/en/track/435815932
Here we cannot use the static loader because the URL of the webpage on which these lyrics are contained does not reference the artist or title in any way.
So what we need to do is use the search loader that can run two searches at a time, where:

- the first search is used to find the ID (435815932). This can be done with any search engine, including that of the website.
  Google has been my best friend on this note: https://www.google.com/search?q=deezer+simple+and+clean+hikaru+utada+lyrics

- lastly, using the first google search result, we are able to obtain the song ID which will then connect us to the lyrics webpage: https://www.deezer.com/en/track/435815932
Last Edit: September 19, 2022, 07:09:44 PM by Mayibongwe
Favourite tune at the moment:   Dearly Beloved by Yoko Shimomura from the Kingdom Hearts soundtrack

SkyZippr

  • Jr. Member
  • **
  • Posts: 121
Is everyone else getting a 'You might also like' in the middle of the lyrics from Genius lately?

sveakul

  • Sr. Member
  • ****
  • Posts: 2460
Not in the middle, but seeing it at the very end of most (not all) Genius lyrics.

SkyZippr

  • Jr. Member
  • **
  • Posts: 121
So I took a look at the source code of Genius, and it seems they are inserting a 'lyrics recommendation' section, either in the middle or at the end of the lyrics depending on its length. Usually those stuff are taken care of and properly removed by the plugin, but since there's a 'you might also like' in plain text within the said section, those words are left intact.

Mayibongwe

  • Sr. Member
  • ****
  • Posts: 1044
  • Heal The World
Hadn't noticed, but that's been taken care of now - redownload the plugin.
And thanks for bringing it to attention!

...........

For people using Metal Archives, there was a minor change I made to that provider.
So you'll need the latest yml from the providers zip to get it working with newer plugin versions.
Favourite tune at the moment:   Dearly Beloved by Yoko Shimomura from the Kingdom Hearts soundtrack

phred

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 9346
Thanks for the update Mayibongwe.
Just for the record, I updated lyrics on 28 tracks this morning with Genius as the source, and not one of them had the reported "you might also like" in them. Obviously this was before the update.

I wonder if it's happening with specific geographic areas.
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

SkyZippr

  • Jr. Member
  • **
  • Posts: 121
Thank you Mayibongwe, the new version works flawlessly.
Fyi I'm located in Japan.

Mayibongwe

  • Sr. Member
  • ****
  • Posts: 1044
  • Heal The World
Just for the record, I updated lyrics on 28 tracks this morning with Genius as the source, and not one of them had the reported "you might also like" in them.
I wonder if it's happening with specific geographic areas.
I think it's unlikely to have been a geographical issue.
I did a Genius test on two songs this morning and the line wasn't so easy to spot at first glance, but it was indeed appearing in both of them.
(and at different locations depending on the length of the lyrics as SkyZippr had mentioned).

If you had a second look, I'm sure you'd spot it somewhere. But in case it truly won't be there, please state one track from the 28 for me to try out with (for curiosity's sake).
Favourite tune at the moment:   Dearly Beloved by Yoko Shimomura from the Kingdom Hearts soundtrack

phred

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 9346
If you had a second look, I'm sure you'd spot it somewhere. But in case it truly won't be there, please state one track from the 28 for me to try out with (for curiosity's sake).
I copied the lyrics into NotePad++ and did a search for "you might also like" and came up with nothing. I tried it with three tracks. While the tracks are quite popular, the album is a bootleg.
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

Mayibongwe

  • Sr. Member
  • ****
  • Posts: 1044
  • Heal The World
Alright. It's cool, no worries.
In any case, the issue's been resolved.
Favourite tune at the moment:   Dearly Beloved by Yoko Shimomura from the Kingdom Hearts soundtrack

sveakul

  • Sr. Member
  • ****
  • Posts: 2460
Hadn't noticed, but that's been taken care of now - redownload the plugin.
And thanks for bringing it to attention!
...........
For people using Metal Archives, there was a minor change I made to that provider.
So you'll need the latest yml from the providers zip to get it working with newer plugin versions.
Finally updated to the latest plugin version and newest providers folder (been putting it off since all worked flawlessly except for the recent Genius glitch) and things work at least as good and probably faster than before.  Thanks for the tuning on Metal Archives.  Best lyrics plugin on the planet now AFAIK and thank you once again for your work.

Mayibongwe

  • Sr. Member
  • ****
  • Posts: 1044
  • Heal The World
Thanks sveakul. It's really nice knowing that I haven't butchered the great work that many people have put behind this project over the years.
We truly have <quick_wango> to thank for the manner in which he designed the plugin - granting users the ability to add any website they so desired was genius (pun intended).
Favourite tune at the moment:   Dearly Beloved by Yoko Shimomura from the Kingdom Hearts soundtrack

Mayibongwe

  • Sr. Member
  • ****
  • Posts: 1044
  • Heal The World
Could you make a tut about customizing the provider files? There are many sites that I want to try.
I'll try to come up with a more detailed explanation the coming weekend.
Let's have a look at this website: https://www.lyrics.com/
We'll be using the song How Do I Live by artist Trisha Yearwood as an example.
The lyrics for it are hosted here: https://www.lyrics.com/lyric/20949555/Trisha+Yearwood/How+Do+I+Live

Code
name: Lyrics
loader: search
name >> this is the provider name that will show up in Preferences / Tags (2) / Lyrics.
loader >> I've already explained in post #165 the different types of loaders, and the reason why we'll be working with the search loader for this website.

Code
variables:
    artist:
        type: artist
        filters:
        - lowercase
        - [replace, ' ', '%2B']

    title:
        type: title
        filters: artist
The variables section is optional. This is where we can format the tags (artist, title and album) received from MusicBee. If for instance, the website you are dealing with throws a 404 error whenever the url contains a period (.) , then you would have to remove/replace every occurrence of that character in your tags before the plugin can conduct the search - otherwise you would never get results for such songs.

For this provider, I have converted the artist and title tags into lower case (probably not necessary but it's just a habit of mine).
I have also replaced whitespaces with a %2B. This is absolutely necessary for this provider as you'll see in a moment.

Code
config:
    identity url: "https://www.google.com/search?q=lyrics.com+{title}+{artist}"
    identity pattern: ['(?<identity>https://www.lyrics.com/lyric/.*?/{artist}.*?)["&]', 's']
identity url >> the plugin will first conduct this search: https://www.google.com/search?q=lyrics.com+how%2Bdo%2Bi%2Blive+trisha%2Byearwood
Then on that webpage, it will look for the first url that matches the defined identity pattern.

In order to know the kind of pattern you have to construct, you'll have to inspect the source code of the webpage.
Don't know about other web browsers but in Chrome, I do that by pressing <Ctrl>+<U> and the resultant html page looks like this for the above google search:



At this point, I usually just copy all of that into Notepad++ as it supports regex searching which will be important in my testing.
So in all that clutter, the identity pattern will go and grab only this part:
Also note how the search would have failed had I not converted trisha yearwood into trisha%2Byearwood.



Code
lyrics url: ""
lyrics pattern: ['<pre id="lyric-body-text".*?>(?<lyrics>.*?)</pre>', 's']
So after the plugin has captured the content (identity) that I'm interested in, it'll go on to combine that with the lyrics url:
lyrics url >> I've left this part blank because we've already captured the entire url needed to take us to the lyrics webpage.

So the plugin actually interprets this lyrics url as <blank> + captured content, which equates to:
<blank> + https://www.lyrics.com/lyric/20949555/Trisha%2BYearwood/How%2BDo%2BI%2BLive

If we had only captured this part: 20949555/Trisha%2BYearwood/How%2BDo%2BI%2BLive
Then the yml would need to have << lyrics url: "https://www.lyrics.com/lyric/" >> so that the next conducted search is:
https://www.lyrics.com/lyric/ + 20949555/Trisha%2BYearwood/How%2BDo%2BI%2BLive

So now that we've finally gotten to our lyrics page, all that's left is to create another pattern which will only capture the lyric portion.
That's what the lyrics pattern is for. Same as the identity thingy, you'll have to inspect the page source and then formulate the necessary pattern.

Code
post-filters:
- strip_html
- utf8_encode
- entity_decode
- clean_spaces
- trim
The post-filters section is also optional.
When included, it serves the purpose of polishing and refining the captured lyrics right before the plugin can send them back to MusicBee.
Last Edit: September 25, 2022, 02:10:30 PM by Mayibongwe
Favourite tune at the moment:   Dearly Beloved by Yoko Shimomura from the Kingdom Hearts soundtrack

phred

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 9346
@Mayibongwe- I think this would be a great addition to the tips and tricks section. If you decide to do so, please let me know that it's complete (via PM) and I will remove your tutorial from this thread and add a link to the Tips and Tricks thread.
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

Corliss Rain

  • Jr. Member
  • **
  • Posts: 63
Hi guys,

I'm getting this system error and then MB shuts down. Help!

MusicBee v3.5.8292.34303D  (Win10.0), 29 Sep 2022 12:39:

System.NullReferenceException: Object reference not set to an instance of an object.
   at CubeIsland.LyricsReloaded.LyricsReloaded.shutdown()
   at CubeIsland.LyricsReloaded.LyricsReloaded.Finalize()