It is currently March 29th, 2024, 1:07 pm

Spotify Lyrics help

Get help with creating, editing & fixing problems with skins
Minimanx
Posts: 8
Joined: October 16th, 2015, 11:01 pm

Spotify Lyrics help

Post by Minimanx »

So, I'm trying to make a skin that grabs lyrics from musixmatch, depending on the song you're listening to (via spotify) and display them. No scrolling or nothing. Just retrieve them from the website and display them. I came up with this, but it's not working. It uses SpotifyPlugin.dll to retrieve song name and artist and then copies it into the website that webparser uses to then find the lyrics. Or at least that's what I thought it would. Nothing shows up though. Please help!

Code: Select all

[Rainmeter]
Update=1000
AccurateText=1

[MeasureLyrics]
Measure=Plugin
Plugin=WebParser
URL=https://www.musixmatch.com/lyrics/[MeasureArtist]/[MeasureTrack]
RegExp=(?siU)lyrics-body">(.*)</span>
StringIndex=1

[MeasureTrack]
Measure=Plugin
Plugin=SpotifyPlugin.dll
Type=TrackName
Substitute="":""

[MeasureArtist]
Measure=Plugin
Plugin=SpotifyPlugin.dll
Type=ArtistName
Substitute="":""

[MeterText]
Meter=String
MeasureName=MeasureLyrics
FontSize=12
User avatar
FreeRaider
Posts: 826
Joined: November 20th, 2012, 11:58 pm

Re: Spotify Lyrics help

Post by FreeRaider »

I don't use spotify plugin, but your code should be:

Code: Select all

[Rainmeter]
Update=1000
AccurateText=1

[MeasureGetLyrics]
Measure=Plugin
Plugin=WebParser
URL=https://www.musixmatch.com/lyrics/[MeasureArtist]/[MeasureTrack]
RegExp=(?siU).*lyrics-body">(.*)</span>

[MeasureLyrics]
Measure=Plugin
Plugin=WebParser
URL=[MeasureGetLyrics]
StringIndex=1

[MeasureTrack]
Measure=Plugin
Plugin=SpotifyPlugin.dll
Type=TrackName
Substitute="":""

[MeasureArtist]
Measure=Plugin
Plugin=SpotifyPlugin.dll
Type=ArtistName
Substitute="":""

[MeterText]
Meter=String
MeasureName=MeasureLyrics
FontSize=12
Read usage of webparser plugin
Minimanx
Posts: 8
Joined: October 16th, 2015, 11:01 pm

Re: Spotify Lyrics help

Post by Minimanx »

Ah, thanks man. I was getting all my info from this http://docs.rainmeter.net/tips/webparser-tutorial/
Still doesn't seem to be working though. In the About / Skins section of Rainmeter I can see that it correctly displays the track and artist names, but they don't seem to work in the webparser URL. I'm getting no results back from it. I checked the page source of multiple different lyrics and I'm sure that RegExp=(?siU)lyrics-body">(.*)</span> is the right thing to search for. Just can't seem to figure it out
User avatar
FreeRaider
Posts: 826
Joined: November 20th, 2012, 11:58 pm

Re: Spotify Lyrics help

Post by FreeRaider »

Ok, I have found a solution:

Code: Select all

[Rainmeter]
Update=1000
AccurateText=1

[MeasureGetLyrics]
Measure=Plugin
Plugin=WebParser
URL=https://www.musixmatch.com/lyrics/[&MeasureArtist]/[&MeasureTrack]
RegExp=(?siU).*lyrics-body">(.*)</span>
DynamicVariables=1

[MeasureLyrics]
Measure=Plugin
Plugin=WebParser
URL=[MeasureGetLyrics]
StringIndex=1

[MeasureTrack]
Measure=Plugin
Plugin=SpotifyPlugin.dll
Type=TrackName
Substitute="":""," ":"-"

[MeasureArtist]
Measure=Plugin
Plugin=SpotifyPlugin.dll
Type=ArtistName
Substitute="":""," ":"-"

[MeterText]
Meter=String
MeasureName=MeasureLyrics
FontSize=12
Try this code.
Minimanx
Posts: 8
Joined: October 16th, 2015, 11:01 pm

Re: Spotify Lyrics help

Post by Minimanx »

Definitely a big step closer! The lyrics show up in the About / Skins section under MeasureLyrics! But, they don't appear on the screen in text form, there doesn't seem to be spaces between linejumps (so every 2-4 words are combined) and the lyrics doesn't change when I change song.
User avatar
FreeRaider
Posts: 826
Joined: November 20th, 2012, 11:58 pm

Re: Spotify Lyrics help

Post by FreeRaider »

Strange. It works for me.
Minimanx wrote:and the lyrics doesn't change when I change song.

Code: Select all

OnChangeAction=[!CommandMeasure MeasureGetLyrics Update]
under [MeasureTrack] should work.

Please post an image of your About / Skins section
Minimanx
Posts: 8
Joined: October 16th, 2015, 11:01 pm

Re: Spotify Lyrics help

Post by Minimanx »

Here you go! http://i.imgur.com/MXd7Asv.png?1

The lyrics change now, with the Update action, but they won't show
Minimanx
Posts: 8
Joined: October 16th, 2015, 11:01 pm

Re: Spotify Lyrics help

Post by Minimanx »

Wait, they actually showed up now! Thanks a ton, man. Everything seems to work really well. If possible though, do you know if you can hide them when the music isn't playing?
User avatar
FreeRaider
Posts: 826
Joined: November 20th, 2012, 11:58 pm

Re: Spotify Lyrics help

Post by FreeRaider »

Minimanx wrote: If possible though, do you know if you can hide them when the music isn't playing?
In that case?
a) Music stopped
b) Player closed
Skitrel
Posts: 4
Joined: November 9th, 2015, 12:29 am

Re: Spotify Lyrics help

Post by Skitrel »

I've been toying with this. It's neat and works.

I'd like to expand on the functionality a bit surrounding musixmatch but have run into a barrier.

What I'd like to do is get the translations working. I tried appending /translation/en/ to the URL but it still spits out the same non-translated lyrics. I think this is caused because the page loads the original lyrics first then uses javascript to add the translated lyrics.

Is there a wait function that could be employed to cause the webparser to wait an extra few seconds after a page load before scraping the data? If not, any ideas for alternate solutions?