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

phred

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 9305
Got it. Thanks much.

It's not doing any harm, and for the most part I'm getting the lyrics I need/want. So I'll leave it enabled along with frankz's.
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

quick_wango

  • Jr. Member
  • **
  • Posts: 108
  • Software Engineer
That's good information to know.  Something to remember when using the plugin is that sites don't want you using plugins like this. They get nothing out of it.  It's a hacked solution.

The plugin is designed to bring up lyrics for songs as you listen to them and then utilize what's built into MB to view or save them.  Like, one song every three or four minutes or so.  That's a reasonable use and not something, I think, that sites would spend much time objecting to or caring much about.  It is not designed (as near as I can tell - I didn't design it) to be a bulk downloading tool. There is some code written for rate limiting, but I don't know how it was meant to work or if it was actually implemented anywhere.

The plugin actually has some rate limiting functionality integrated as I hit that problem as well back in the day. I think I never actually documented that though. Might even be completely untested :D

For developing new providers or testing existing ones I can recommend using the included unit test suite and testing tool, helped me a lot during development and maintenance. I became fairly quick at hacking together new provider configs.

It's great to see this still alive and kicking! I'm still open to assisting with technical problems, if wanted.
Last Edit: February 12, 2020, 11:45:13 PM by quick_wango

quick_wango

  • Jr. Member
  • **
  • Posts: 108
  • Software Engineer
I don't really have the know-how, either, but the OP for the original lyrics reloaded states that it's not an update of Steven's plugin but a total rewrite, and since he did use some sources from the original plugin and didn't use others, I'd assume the reason he decided not to use the sources that he chose not to use was that those sites are not compatible with the structure of the plugin.

In fact, looking at that OP now, he says certain sources are "not possible yet" in that post, and those include the ones from the original plugin that he didn't use.

If something has changed and you're able to make a working YML file for any of those sites, I'll be happy to add it into the plugin.  I've been pretty clear that the kind of RegEx skill needed to create these files is not in my wheelhouse and life is kind of coming at me too fast in this last year to get anywhere close to learning it.

The great thing about Lyrics Reloaded is that anyone can add sites to it on their own and then offer the YML for others to use, too.

Wish I could be more helpful, but I'm really just an overseer of the plugin.  My skills are such that I can do cleanup and maintenance but not really creation.

The two don't interfere with each other at all as far as I can tell.  Why not just use both?

The architecture of the plugin allows to implement entirely different provider concepts side-by-side (in the codebase they are called LyricsLoader). The current concept (StaticLoader) relies entirely on the websites having a stable and predictable URL per song, that can be derived just from the limited song metadata that is available (which often can be done with surprising accuracy as you know).
I originally planned to implement a second loader implementation that tries to use search functions of the websites. so the flow would be like:

1. Construct a search query based on the song metadata
2. Call the site's search functions
3. Extract song URLs from the search results
4. Try to find a single best match in the results, possibly applying some fuzziness
5. Extract the lyrics from the matched URL's site as usual

So provider Yaml files would require a couple more options (search URL, search query filters, URL extraction regex) for these.

In case someone is interested in implementing this, I can assist, but I will not implement this myself as long as there is no native MusicBee for Linux.
Last Edit: February 12, 2020, 11:46:39 PM by quick_wango

phred

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 9305
@frankz...

I'm testing 3.4 alpha and discovered that the last two versions I've used are trying to connect to GitHub. This doesn't happen in 3.3 so I'm a little concerned. I'm using the same plugin version in both 3.3 and 3.4.

I now have it disabled in 3.4 but it's one of my two most used plugins, so I'd like to know what's going on and why the need to connect to GitHub.

See here for my initial question to Steven:  https://getmusicbee.com/forum/index.php?topic=31125.0

Thanks.

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

frankz

  • Sr. Member
  • ****
  • Posts: 3835
It's checking for updates.  Always has, back to the original version.  The only change I ever made to this was to change the URL from the original repository to my updated one, and I did that early on.

Here's the code
Code
public delegate void UpdateCheckerCallback(bool updateAvailable);

        public void checkForNewVersion(UpdateCheckerCallback callback)
        {
            Version local = Assembly.GetAssembly(GetType()).GetName().Version;

            LyricsReloaded lr = this;

            Thread updateChecker = new Thread(() => {
                WebClient cl = new WebClient(lr, 5000);
                try
                {
                    bool result = false;
                    WebResponse respone = cl.get("https://raw.githubusercontent.com/mbfrankz/LyricsReloaded/stable/LyricsReloaded/Properties/AssemblyInfo.cs");
                    if (respone != null)
                    {
                        String content = respone.getContent();
                        if (!String.IsNullOrWhiteSpace(content))
                        {
                            Regex versionRegex = new Regex("AssemblyVersion\\(\"(?<version>[^\\s\\*]+)\"\\)", RegexOptions.Compiled | RegexOptions.Singleline);
                            Match match = versionRegex.Match(content);
                            if (match.Success)
                            {
                                Version remote = Version.Parse(match.Groups["version"].Value);
                                result = remote.CompareTo(local) > 0;
                            }
                        }

                    }

                    callback(result);
                }
                catch (Exception e)
                {
                    lr.logger.error("Failed to check for updates: {0}", e.Message);
                }
            }) {
                IsBackground = true,
                Name = "LyricsReloaded - Version Check"
            };
            updateChecker.Start();

phred

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 9305
It's checking for updates.
Thank you frankz. I would've been satisfied with your answer without the code, but that was appreciated.
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


ShotgunStev3

  • Newbie
  • *
  • Posts: 3
Hey frankz!
Amazing plugin. Great integration with MusicBee, it's now my first choice for tagging songs with lyrics.
Question though on the Genius config, it seems that enough though the "[Verse 1] [Chorus] [Bridge]" etc tags are stripped perfectly, the line that they were on still remains. Meaning, in between sections there are two blank lines. Obviously, this doesn't happen with songs on the site without those identifiers.
Can one change the config so this doesn't happen, or is this an obstacle with the Genius site itself?

Thanks!

frankz

  • Sr. Member
  • ****
  • Posts: 3835
Someone better at RegEx than I am (which wouldn't be hard to be) could probably add whatever character or characters create a new line there to the RegEx statement to take it out, but that's beyond my skill.

The config YML is on GitHub if you want to download it and experiment with creating a custom config that does this. Change the name field to something like Genius (Test) and name the yml something different and put it in your "Providers" folder so you can go back and forth between them. If it works I can add it to the plugin at some point.

This is the line that does that edit:
Code
- [regex, '\[.{1,75}\]', ""]

ShotgunStev3

  • Newbie
  • *
  • Posts: 3
After a lot of struggling on StackOverflow, It seems I should've looked through Filters/README.md first  :-X

Code
- [replace, "\n\n", "\n"]

This line will concatenate two blank lines into one

Turning this:

Into this:


And then at the end I used the 'trim' command in the filter.cs to remove the blankspace at the beginning



So, all in all, i added these two lines to the post-filters:
Code
- [replace, "\n\n", "\n"]
- trim

Thanks for the pointers and thanks again for the great plugin!

frankz

  • Sr. Member
  • ****
  • Posts: 3835
This seems like a useful addition, so I've added it to the built-in Genius provider.  Updated version here. Thanks for that, you've made the plug-in better!

sveakul

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

EGraf

  • Newbie
  • *
  • Posts: 5
Hi, just a small bug report, I was having problems with a song with round brackets in its (official) name. The song in question was "Phantom Divine (Shadow Empire)" by Kamelot and I was not able to get any lyrics for it, but worked when I renamed it to "Phantom Divine Shadow Empire"

sveakul

  • Sr. Member
  • ****
  • Posts: 2438
FWIW spotted this on another player's forum where someone had issues getting lyrics from lyrics.wikia.com:  "..Also,  lyrics.wikia.com is now moved to fandom, and new url is - https://lyrics.fandom.com/wiki/LyricWiki "

Attempts to load lyrics.wikia.com from a browser get automatically sent to https://lyrics.fandom.com/wiki/LyricWiki , but not sure if/how that may affect future searches there from LyricsReloaded (Updated).

frankz

  • Sr. Member
  • ****
  • Posts: 3835
FWIW spotted this on another player's forum where someone had issues getting lyrics from lyrics.wikia.com:  "..Also,  lyrics.wikia.com is now moved to fandom, and new url is - https://lyrics.fandom.com/wiki/LyricWiki "

Attempts to load lyrics.wikia.com from a browser get automatically sent to https://lyrics.fandom.com/wiki/LyricWiki , but not sure if/how that may affect future searches there from LyricsReloaded (Updated).
Hmmm...I'm not sure that LyricWiki is viable for the plugin anymore.  The plugin takes the lyrics from the text of the HTML of the web page, but now that LyricWiki is a fandom site it seems that it loads the lyric box some other way and doesn't put the lyrics in the HTML in plain text.

If you go here, view source, and search the source for "Try to see it my way" those words are nowhere to be found.  If the lyrics aren't in the source in text, they can't be retrieved by the plug-in.

I originally removed LyricWiki from the plug-in because it's now native to MB and seemed to be redundant. I don't remember why I put it back in, maybe someone asked or maybe because I put the Gracenote portion back in and figured I'd throw it back in too just in case, but it seems like it should be taken out and the native LyricWiki options should be used if that's desired as a source.
Hi, just a small bug report, I was having problems with a song with round brackets in its (official) name. The song in question was "Phantom Divine (Shadow Empire)" by Kamelot and I was not able to get any lyrics for it, but worked when I renamed it to "Phantom Divine Shadow Empire"
Parenthesis should be stripped out of the constructed url when they'll cause a problem at the site. If you look in the log for the plug-in (%AppData%/Roaming/MusicBee/mb_LyricsReloaded) it should tell you the constructed URL for each site the plug-in accessed and which sites could and couldn't find the lyrics.  If you go to each URL you'll see why the lyrics were and weren't found there.

Is it possible that the lyrics came from one of the native sources? They use a different method (API) to retrieve lyrics.  The plug-in is basically a web browser that pulls one specific text portion of the retrieved page.