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

frankz

  • Hero Member
  • *****
  • Posts: 1495
I've updated the long-abandoned LyricsReloaded plugin with new providers that individual users scripted in the original plugin's thread.  I've also deleted outdated providers that no longer worked and did other miscellaneous cleanup on it.

Current Providers
A-Z Lyrics Universe
Cušpajz
Genius
Letras de músicas
LyricWiki
LyricWiki (Gracenote)
Metrolyrics
Musixmatch_Asian
Musixmatch
Oldies Lyrics
Smriti
Song Lyrics
Teksty
Urban Lyrics
Hindi Lyrics

NOTE: If you have custom yml files in your \providers\ folders for any of the above, that provider will show up twice in Edit->Edit Preferences->Tags(2).  Make sure you select the appropriate one to meet your needs (built in or custom yml). To avoid duplicates, delete unneeded yml files from your \providers\ folder.

Changelog

1.1.6 Changes:
Added LyricWiki back in as API used by native was providing incomplete results
Renamed LyricWiki to LyricWiki Reloaded and LyricWiki Gracenote to LyricWiki Gracenote Reloaded to avoid confusion
Updated revision from 1.1.5 to 1.1.6

1.1.5 Changes:
Added Metrolyrics back in
Added LyricWiki (Gracenote) back in as I was getting better results here than with native MB Gracenote (YMMV)
Updated revision from 1.1.4 to 1.1.5

1.1.4 Changes:
Removed provider Rapgenius, which was the original name of Genius.
Removed provider LyricWiki, which is now native to MB
Removed provider LyricWiki (Gracenote), as Gracenote is now native to MB
Updated revision from 1.1.3 to 1.1.4

1.1.3 Changes:
Got rid of the "Configure" button that didn't do anything (besides confuse a lot of people, me included)
And added a message on the Plugins page about where to configure the plug-in
Removed non-functioning provider PinkRadio
Removed non-functioning provider Tesktowo
Added provider Genius based on forum-provided script
Added provider MusixMatch based on forum-provided script
Changed the description to something a little less confrontational sounding
Updated copyright to -2018
Added myself as maintainer while retaining plugin's original author's credit
Updated revision from 1.1.2 to 1.1.3

Install guidance, a link to the source and changelog on Github, and, of course, the download link for the plugin can be found on the plugin page.

Documentation about how to create YML files is here.

All credit for the functionality of the plugin goes to Steven (I think) and quick_wango, who conceived and wrote it.  I'm just maintaining it.  If something doesn't work right, I can try to fix it, but I can't guarantee quick turnaround as I'm still pretty novice at C#.  

Feel free to script new plugin sites that you find and post them to this thread.  I will add them into the plugin as needed.

Latest Version: https://github.com/mbfrankz/LyricsReloaded/releases/tag/1.1.6
Last Edit: August 18, 2018, 04:23:24 PM by frankz


Boile

  • Jr. Member
  • **
  • Posts: 67

frankz

  • Hero Member
  • *****
  • Posts: 1495
Documentation
================
Regular expressions
This plugin relies heavily on Microsoft-flavored regular expression for its functionality. Tutorials and tools to write these expressions are all over the internet, for example RegExr which is a greate tool to write and test regular expressions.

Using these regexes is usually done in 2 ways:

1. a single string, which specifies only the regex
2. an array of 2 strings that specifies the regex in its first element and regex options as its second element. Example: ["regex", is]

There are 2 things to watch out for:

1. backslashes (\) must be escaped when using double quotes ("), as it is a meta character in the YAML format: \s -> \\s
2. named capturing groups are defined like this: (?<lyrics>.*?) with "lyrics" being the name of the group


Regex options
The regex options are specified as a string that contains the characters for the options. A lowercase character enables the options, an uppercase character disables the options.

The options:

i: the regex is case insensitive
s: the input string is seen as a single line
m: the input is seen as multiple lines
c: the regex will be compiled (improves execution performance, but slows startup)
x: whitespace in the regex will be ignored (nice for complex regexes)
d: the regex will go from right to left though the string
e: only named capturing groups will be used
j: the regex will be ECMA script compatible
l: the regex will be culture invariant

==============================================================

Filter
Filters are small functions that can modify the given content. Filters can currently be applied to variable values and the lyrics content.

Important: The filters are executed in the specified order, so stripping HTML-tags before converting <br> tags to newlines won't get you far.

strip_html
This filter removes all HTML tags from the content.

entity_decode
This filter decodes HTML entities like &copy; -> ©.

strip_links
This filter removes links from the lyrics.

utf8_encode
This filter converts the content's encoding to UTF-8 (without BOM).

br2ln
This filter converts <br> tags to newlines (\n).

p2break
This filter converts </p> tags to 2 newlines (\n) indicating a new paragraph.

clean_spaces
This filter cleans up the whitespace of the content by normalizing line endings, converting tabs to spaces, vertical tabs to newlines and removing unnecessary newlines and spaces.

trim
This filter removes whitespace from the beginning and the end of the content.

lowercase
This filter converts the whole content to lower case. Optionally you can provide a culture name as the first argument.

By default the conversion is culture unaware.

uppercase
This filter converts the while content to upper case Optionally you can provide a culture name as the first argument.

By default the conversion is culture unaware.

diacritics2ascii
This filter removes diacritics from the content, so "äöüß" becomes "aous".

umlauts2ascii
This filter is specialized version of diacritics2ascii that handles only the german umlauts and replaces them with their two character representation, so "äöüß" becomes "aeoeuess".

urlencode
This filter URL-encodes the content where necessary, so a space becomes +.

urlencode
This filter URL-encodes the content where necessary, so a space becomes %20.

regex
This filter does a regex replace, the first argument is the regex (which will be cached) and the second argument is the replacement which may contain backreferences. Optionally a third argument can be given which specifies regex options

Example usage: [regex, '\s+?', " "]

strip_nonascii
This filter removes all non-ASCII characters. The filter has 2 optional arguments: The first is a replacement for the removed character and the second one specifies whether the replacement can be inserted multiple times in a row.

Examples:

1. strip_nonascii -> "test *** test" -> "testtest"
2. [strip_nonascii, -] -> "test *** test" -> "test-test"
3. [strip_nonascii, -, duplicate] -> "test *** test" -> "test-----test"

replace
This filter replaces the given search string (first argument) with the replacment (second argument).

Example usage: [replace, search, replace]

===============================================================

Validators
Validators are meant to verify the loaded lyrics. An example where this would be necessary: A website that doesn't return an error 404 when lyrics were not found, but instead show a page with the exact same format, but a "not found"-message instead of lyrics. The result of validators can be inverted by prefixing their name with "not ".

Examples:

- [contains, lyrics]
- [not contains, not found]

contains
This validator checks whether the content contains a given string (first argument).

matches
This validator checks whether the given regex matches something in the content. It takes a regular expression (first argument) and options for it (second argument)

======================================================

Example Configuration YML File

Code
# the name of the provider. this will be shown in MusicBee's settings
name: 'Example'

# the loader for this provider: static, search, api
loader: static

# prepare the input
variables:
# filters to apply to the artist
artist:
type: artist # the source of the value
filters:
- strip_diacritics
- [stripdown, _]
- urlencode

# filters to apply to the album
# album: skip entry omitted as it isn't needed

# filters to apply to the title
title:
type: title
filters: artist # reference the filters of artist    

post-filters:
- strip_html
- utf8_encode
- trim

validations:
- [not contains, Click here to submit these lyrics]

config:
# the URL to request. {artist}, {album} and {title} are placeholders for the values from the song.
url: "http://www.azlyrics.com/lyrics/{artist}/{title}.html"
    
# The regular expression to apply to the content of the website. The pattern must contain a named capturing group called "lyrics" like: (?<lyrics>.+?)
# variables are allowed as well
pattern: '<!-- start of lyrics -->(?<lyrics>.+?)<!-- end of lyrics -->'

# The options for the pattern:
# - i: case insensitive
#
# more to come
pattern-options: 'i'

sveakul

  • Hero Member
  • *****
  • Posts: 988
Terrific stuff, thanks for the new update!  Using it regularly to check lyrics on playing radio stations.

frankz

  • Hero Member
  • *****
  • Posts: 1495
Terrific stuff, thanks for the new update!  Using it regularly to check lyrics on playing radio stations.
Just happy to be part of something that people seem to enjoy.

Freddy Barker

  • Hero Member
  • *****
  • Posts: 678
  • 🎧 MB 3.3.7199 P
Hey frankz,

I came across this old post showing what looks like scrolling lyrics in Theatre Mode, would be a great alternative to using Miniyrics...

https://getmusicbee.com/forum/index.php?topic=20396.msg121087#msg121087

Is this something that could work by using your new LyricsReloaded plugin?

Regards: Freddy

frankz

  • Hero Member
  • *****
  • Posts: 1495
Hey frankz,

I came across this old post showing what looks like scrolling lyrics in Theatre Mode, would be a great alternative to using Miniyrics...

https://getmusicbee.com/forum/index.php?topic=20396.msg121087#msg121087

Is this something that could work by using your new LyricsReloaded plugin?

Regards: Freddy
It just retrieves lyrics from public sites. If you find a public site that displays synchronized lyrics with the information necessary to display them in MB, the plugin can be made to retrieve those and display them in MB by creating a YML script as described in the Documentation post above.

Freddy Barker

  • Hero Member
  • *****
  • Posts: 678
  • 🎧 MB 3.3.7199 P
It just retrieves lyrics from public sites. If you find a public site that displays synchronized lyrics with the information necessary to display them in MB, the plugin can be made to retrieve those and display them in MB by creating a YML script as described in the Documentation post above.

Much obliged frankz - all looks rather complex  :-X

phred

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4694
...scrolling lyrics...
There is only one place remaining that offers 'synced' lyrics and that's MiniLyrics. For which you need to install the MiniLyrics app alsong with its plugin for MB.
https://getmusicbee.com/forum/index.php?topic=1864.msg66983#msg66983
Download the latest MusicBee v3.3 patch from here.
Unzip into your MusicBee directory and overwrite existing files.

----------
Check out the MusicBee Wiki.
How to post screenshots is here.

Freddy Barker

  • Hero Member
  • *****
  • Posts: 678
  • 🎧 MB 3.3.7199 P
...scrolling lyrics...
There is only one place remaining that offers 'synced' lyrics and that's MiniLyrics. For which you need to install the MiniLyrics app alsong with its plugin for MB.
https://getmusicbee.com/forum/index.php?topic=1864.msg66983#msg66983

Hi phred and thanks for the 'heads-up'.
I am using MiniLyrics sometimes, however when using Theatre Mode (which is most of the time), Theatre Mode full-screen takes precedence over MiniLyrics, thus the lyrics are not displayed. So was hoping it could be done using this TM I found that looks like it could display scrolling lyrics....
Synchronised Lyrics Theatre Mode

Not sure or about or skilled enough to work through the functionality required to provide such a feature...

Best regards: Freddy


frankz

  • Hero Member
  • *****
  • Posts: 1495
I am using MiniLyrics sometimes, however when using Theatre Mode (which is most of the time), Theatre Mode full-screen takes precedence over MiniLyrics, thus the lyrics are not displayed. So was hoping it could be done using this TM I found that looks like it could display scrolling lyrics....
Synchronised Lyrics Theatre Mode

Not sure or about or skilled enough to work through the functionality required to provide such a feature...

Best regards: Freddy


Probably a good question to ask in a Theater Mode thread.  This plugin does lyric retrieval only.

quick_wango

  • Jr. Member
  • **
  • Posts: 106
  • Web and Application Developer
I, as the original auther, request you to comply with the license terms of the GPLv3.

Generally I'm also open for Pull Requests, I will build new releases when changes come in.
Administrator and Head Developer at http://cubeisland.de

frankz

  • Hero Member
  • *****
  • Posts: 1495
Plugin deleted.  All yours.  You can even have the thread.

In the future, you may wish to monitor the thread about your plug-in, so that when people ask things like "is this abandoned?" or "I'd like to update this but don't want to step on anyone's toes, what's the protocol?" there won't be misunderstandings.
Last Edit: May 21, 2018, 08:03:56 PM by frankz

Freddy Barker

  • Hero Member
  • *****
  • Posts: 678
  • 🎧 MB 3.3.7199 P