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

Mayibongwe

  • Hero Member
  • *****
  • Posts: 513
Download the new plugin version from the add-on link here.

What started out last weekend as a quest to learn the general workings of regular expressions has somehow led to me finding my way around the Lyrics Reloaded plugin. I am not really someone who knows what they're doing, but I figured since I could make sense of some of the code, I might as well make one or two enhancements...and that is exactly what I have done. I have received permission from frankz - the forum hero member who revived the then-abandoned plugin and kept it alive ever since - to publish my version of this plugin and essentially take over the responsibilities associated with it and its userbase.

Changes:

-   The plugin appears to have originally been designed to make use of three lyrics loaders or retrieval methods (static, search and API)
    But only one was ever implemented from what I can tell - the static loader which requires websites to have straightforward, predictable URLs.
    Users can now make use of a search loader which is capable of retrieving lyrics from URLs with unique IDs for every track.

-   The log file has now been programmed to reset every ten MusicBee sessions (startups, to be precise) in order to keep its length at a reasonable range.

-   Genius, Musixmatch and Deezer have been added as built-in providers.  

-    Added a non-UI setting that allows you to either enable or disable the line that shows where retrieved lyrics are from.
     There's also another setting to accompany it that allows you to position the displayed source at the top or bottom.

Credits:

-   @quick_wango (created this invaluable plugin)
-   @frankz (resuscitated the plugin)
-   @Steven (no MusicBee, no plugin)
-   Every other MusicBee user who contributed towards this project (such as providing regex fixes, etc.)

How to use the new loader:

The search loader functions more or less the same as the static loader. The difference lies in the definition of the config section.

identity url           refers to the site address where the song search is conducted.
identity pattern   refers to the pattern that extracts the unique ID for the song (if it exists).
lyrics url               refers to the previous url's homepage which will be auto-concatenated with the unique ID previously extracted.
lyrics pattern       refers to the pattern that extracts the lyric content.

Example:
Code
name: Lyrics Freak
loader: search

variables:
    artist:
        type: artist
        filters:
        - lowercase

    title:
        type: title
        filters: artist
        
config:
    identity url: "https://www.lyricsfreak.com/search.php?q={artist}+{title}"
    identity pattern: ['[^a]\shref="(?<identity>.*?)"', 's']
    lyrics url: "https://www.lyricsfreak.com"
    lyrics pattern: ['data-title=".*">(?<lyrics>.*)<div class="lf-marker\s', 's']
    
post-filters:
- strip_html
- utf8_encode
- entity_decode
- [regex, '\[.*?\].*?(\w)', '$1', s]
- [regex, '\(feat\..*?\)', '', s]
- [regex, '.*?(\w.*)', '$1', s]
- trim
Last Edit: October 22, 2022, 12:38:53 PM by Mayibongwe

Mayibongwe

  • Hero Member
  • *****
  • Posts: 513
Current list of optional providers
These will be kept up to date and accessible from the same add-on link in the previous post.

-   Cušpajz
-   Google
-   Letras de músicas
-   Lyrics
-   Lyrics Freak
-   Lyrics Mania
-   Lyrics Mode
-   Megalobiz
-   Metal Archives
-   Oldie Lyrics
-   Pesni Guru
-   Smriti
-   Song Lyrics
-   Teksty

After a long period of testing I think I can draw up some conclusions for myself.
The plugin is giving fantastic results these days, using this order of providers which I have found to be optimal:

1. Genius
2. MusixMatch
3. Deezer
4. Metal Archives (*)
5. Genius (fuzzy)
6. Deezer (fuzzy)

(*) only useful if you have a lot of (more obscure?) metal

Have a look at these stats by hiccup if you wish to know which providers have better success rates:
-   https://getmusicbee.com/forum/index.php?topic=36952.msg205407#msg205407
-   https://getmusicbee.com/forum/index.php?topic=36952.msg203168#msg203168

All you need to know about how to make a custom provider:
-   https://getmusicbee.com/forum/index.php?topic=25406.msg145769#msg145769
-   https://getmusicbee.com/forum/index.php?topic=36952.msg204745#msg204745
Last Edit: October 22, 2022, 12:36:31 PM by Mayibongwe

Mayibongwe

  • Hero Member
  • *****
  • Posts: 513
Some of the reasons behind the removal of other default providers: https://getmusicbee.com/forum/index.php?topic=9994.msg116979;topicseen#msg116979
Does anybody object to the change and would like for those to be added back as defaults?

sveakul

  • Hero Member
  • *****
  • Posts: 2033
[placeholder]
This is where other working yml's will be located and kept to up to date.
1.  What does the above post actually mean?  It seems incomplete (--[placeholder]?).

2.  Can you please provide the download in a zipped package with a version number (and preferably a readme) so we can keep things easily separated from other versions?  BTW, downloaded DLL has a version number of 1.1.13.

3.  THANKS for implementing this new revision/technique;  haven't tried it yet but I will get back with comments.
Last Edit: July 30, 2022, 06:13:37 PM by sveakul

sveakul

  • Hero Member
  • *****
  • Posts: 2033
Replaced the old DLL with the new one just downloaded and started MusicBee;  MusicBee crashes after displaying this error message:

MusicBee v3.5.8245.32534P  (Win10.0), 30 Jul 2022 13:08:

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


Mayibongwe

  • Hero Member
  • *****
  • Posts: 513
Oh boy. Can somebody else confirm the error above?
sveakul, can you delete the log file and start MusicBee again to see what happens? It's the only thing right now I think can be related to the message.

Mayibongwe

  • Hero Member
  • *****
  • Posts: 513
1.  What does the above post actually mean?  It seems incomplete (--[placeholder]?).

2.  Can you please provide the download in a zipped package with a version number (and preferably a readme) so we can keep things easily separated from other versions?  BTW, downloaded DLL has a version number of 1.1.13.

3.  THANKS for implementing this new revision/technique;  haven't tried it yet but I will get back with comments.
#1
I intend to go over all the default yml's to confirm if they're all functional.
When I've done that, I'll include them in that post for everyone to access them (either through a download link or as literal text inserted using the forum's code tag).

#2
I will do that just now.

#3
I need as much feedback as I can. I'm new to all this and need pointers to anything I'm overlooking.

hiccup

  • Hero Member
  • *****
  • Posts: 6350
Oh boy. Can somebody else confirm the error above?
It seems to work here. (on 3.5.8237p)
This is now the default order, right?:



edit:
updated to 3.5.8246, still working

Mayibongwe

  • Hero Member
  • *****
  • Posts: 513
Also just updated to 3.5.8246P and all is working fine.
@sveakul, maybe it's conflicting with other reloaded versions? Idk. Try to remove the other reloaded plugins from the plugins folder as well to see if the error still pops up.

@hiccup, actually, there should be only one default provider (Google). I removed the other providers.
Could it be that those 3 providers are your own located in AppData\mb_LyricsReloaded\providers ?
But still, there should be a 'google' appearing there, unless you've unticked it.

Can y'all confirm if the downloaded dll has a modification/creation date of ‎Friday, ‎July ‎29, ‎2022 ?

sveakul

  • Hero Member
  • *****
  • Posts: 2033
Oh boy. Can somebody else confirm the error above?
sveakul, can you delete the log file and start MusicBee again to see what happens? It's the only thing right now I think can be related to the message.

This time uninstalled the existing DLL first instead of copying over, incl. deleting the logs, the subfolder in Appdata, etc.  Added the new DLL via the MB "Add Plugin" menu and received this error:



MusicBee crashes afterwards on attempting to Save.  Why would it be looking for a log file that has yet to be created?

hiccup

  • Hero Member
  • *****
  • Posts: 6350
I'm sorry, I just tested very briefly (with half a mind) only to check/confirm if there was a serious bug when starting.
I'll do some proper testing later.
You are probably right about my appdata. I recall naming the providers "(new)" myself some time ago.

sveakul

  • Hero Member
  • *****
  • Posts: 2033
OK, here we go:

1.  I created an empty text file named mb_LyricsReloaded.log in the AppData/mb_LyricsReloaded subfolder (the "providers" folder had already been created by the first load attempt) and restarted MusicBee.

2.  BANG!  It works!  :)

3.  In Tags(2), the available providers list from the clean install shows Google, and "chartlyrics.com" of all things. I assume the latter was never actually removed from the original plugin, as it's not present as a yml file.

Going to add my yml's now and test how they coexist with Google.
Last Edit: July 30, 2022, 07:29:39 PM by sveakul

sveakul

  • Hero Member
  • *****
  • Posts: 2033
The following yml files I was using with the old version work with this one and cycle properly through the "Search Next provider" option: azlyrics, genius, metrolyrics, musicmatch.  The code of the actual files can be found in the old thread, don't have time to hunt them down now.

Mayibongwe, great job on the new Google source, it seems to be working amazingly well!  Very much appreciate your effort.

sveakul

  • Hero Member
  • *****
  • Posts: 2033
Some of the reasons behind the removal of other default providers: https://getmusicbee.com/forum/index.php?topic=9994.msg116979;topicseen#msg116979
Does anybody object to the change and would like for those to be added back as defaults?

I would like to see songlyrics.com added back as a source in the DLL;  AFAIK no yml file exists for that one, and it picks up a lot of more obscure metal and goth stuff.

Edit:  OOPS, found one on frankz's GitHub site and it does work;  copy the code below to a textfile like "songlyrics.txt", change the extension to .yml, pop it in Providers and add under Tag(s)2 after restarting MB.

Code
name: Song Lyrics

variables:
    artist:
        type: artist
        filters:
        - lowercase
        - [regex, '[^\sa-z0-9]', ""]
        - [strip_nonascii, -]
    title:
        type: title
        filters: artist

config:
    url: "http://www.songlyrics.com/{artist}/{title}-lyrics/"
    pattern: ['<div id="songLyricsDiv-outer">(?<lyrics>.*?)</div>', s]
    
post-filters:
- strip_html
- entity_decode
- clean_spaces
- utf8_encode
- [fix_broken_chars, 'Ã', ISO-8859-1]
- [replace, 'þ', 'ß']
Last Edit: July 30, 2022, 08:18:50 PM by sveakul

Mayibongwe

  • Hero Member
  • *****
  • Posts: 513
My deepest apologies to the forum for the massive scare.
I investigated the cause of the error reported by sveakul and found out that it was a result of something I had overlooked when setting the log file to be cleared.
I hadn't put any error handling in there to ensure that the file existed or not before doing any operations on it. But that is fixed now and I have confirmed it.

Would appreciate a 2nd confirmation by sveakul. Re-download the plugin.
I have also done your initial recommendations, such as including a readme file to the download - which is merely a copy from this plugin's previous versions.
I'll edit it to include the changes I've made a bit later.

Apologies again.