It is currently March 28th, 2024, 7:17 pm

Spotify Lyrics help

Get help with creating, editing & fixing problems with skins
User avatar
FreeRaider
Posts: 826
Joined: November 20th, 2012, 11:58 pm

Re: Spotify Lyrics help

Post by FreeRaider »

Can you post your code and the name of author and track title you are looking for?
User avatar
winterwulf
Posts: 94
Joined: August 17th, 2016, 1:48 am
Location: São Paulo - Brazil

[SOLVED] Re: Spotify Lyrics help

Post by winterwulf »

Not working for me as well...

is there anyway to troubleshoot it? I cant find the reason it wont work
Last edited by winterwulf on August 29th, 2016, 11:53 am, edited 1 time in total.
User avatar
FreeRaider
Posts: 826
Joined: November 20th, 2012, 11:58 pm

Re: Spotify Lyrics help

Post by FreeRaider »

winterwulf wrote:Not working for me as well...

is there anyway to troubleshoot it? I cant find the reason it wont work

Can you post your code and the name of author and track title you are looking for?
User avatar
winterwulf
Posts: 94
Joined: August 17th, 2016, 1:48 am
Location: São Paulo - Brazil

Re: Spotify Lyrics help

Post by winterwulf »

Code: Select all

[Rainmeter]
Update=1000
AccurateText=1
SkinWidth=512
OnRefreshAction=[!SnapEdges "0" "#CURRENTCONFIG#"]
ContextTitle=Open @Includes folder
ContextAction=["#@#"]

[Variables]
ScrollSpeed=20
Height=500

@Include1=#@#GeneralVariables.inc
@Include2=#@#ClockWeatherSpeech.inc
@Include3=#@#WXDataWeatherVars.inc
@Include4=#@#WXDataWeatherRegExp.inc
Size=140

[MeterBack]
Meter=Image
ImageName=#ImagePath#FlexBack.png
X=0
W=512
H=250
ScaleMargins=3,3,3,3
ImageTint=#BackgroundColor#
DynamicVariables=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
Substitute="":"Searching..."

[MeasureTrack]
Measure=Plugin
Plugin=SpotifyPlugin.dll
Type=TrackName
Substitute="":""," ":"-","\W+":"-"
OnChangeAction=[!CommandMeasure MeasureGetLyrics Update]

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


[MeterText]
Meter=String
MeasureName=MeasureLyrics
MouseScrollDownAction=[!SetOption MeterText y ([MeterText:y]<0?([MeterText:y]+#ScrollSpeed#):[MeterText:y])][!SetOption MeterText H ([MeterText:y]<0?[MeterText:H]-#ScrollSpeed#:[MeterText:H])][!Update]
MouseScrollUpAction=[!SetOption MeterText y ([MeterText:y]-#ScrollSpeed#)][!SetOption MeterText H ([MeterText:H]+#ScrollSpeed#)][!Update]
FontSize=16
y=0
W=512
H=#Height#
FontFace=Segoe UI
FontColor=255,255,255,180
StringEffect=BORDER
AntiAlias=1
DynamicVariables=1
SolidColor=0,0,0,1
MouseActionCursor=0

I didn't get it to work with any song at all..

Right now I am trying with Ozzy Osbourne - Shot in the dark

Thanks for your help :)
User avatar
FreeRaider
Posts: 826
Joined: November 20th, 2012, 11:58 pm

Re: Spotify Lyrics help

Post by FreeRaider »

winterwulf wrote:

Code: Select all

[Rainmeter]
Update=1000
AccurateText=1
SkinWidth=512
OnRefreshAction=[!SnapEdges "0" "#CURRENTCONFIG#"]
ContextTitle=Open @Includes folder
ContextAction=["#@#"]

[Variables]
ScrollSpeed=20
Height=500

@Include1=#@#GeneralVariables.inc
@Include2=#@#ClockWeatherSpeech.inc
@Include3=#@#WXDataWeatherVars.inc
@Include4=#@#WXDataWeatherRegExp.inc
Size=140

[MeterBack]
Meter=Image
ImageName=#ImagePath#FlexBack.png
X=0
W=512
H=250
ScaleMargins=3,3,3,3
ImageTint=#BackgroundColor#
DynamicVariables=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
Substitute="":"Searching..."

[MeasureTrack]
Measure=Plugin
Plugin=SpotifyPlugin.dll
Type=TrackName
Substitute="":""," ":"-","\W+":"-"
OnChangeAction=[!CommandMeasure MeasureGetLyrics Update]

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


[MeterText]
Meter=String
MeasureName=MeasureLyrics
MouseScrollDownAction=[!SetOption MeterText y ([MeterText:y]<0?([MeterText:y]+#ScrollSpeed#):[MeterText:y])][!SetOption MeterText H ([MeterText:y]<0?[MeterText:H]-#ScrollSpeed#:[MeterText:H])][!Update]
MouseScrollUpAction=[!SetOption MeterText y ([MeterText:y]-#ScrollSpeed#)][!SetOption MeterText H ([MeterText:H]+#ScrollSpeed#)][!Update]
FontSize=16
y=0
W=512
H=#Height#
FontFace=Segoe UI
FontColor=255,255,255,180
StringEffect=BORDER
AntiAlias=1
DynamicVariables=1
SolidColor=0,0,0,1
MouseActionCursor=0

I didn't get it to work with any song at all..

Right now I am trying with Ozzy Osbourne - Shot in the dark

Thanks for your help :)
Replace your code with this piece of code:

Code: Select all

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

[MeasureLyrics]
Measure=Plugin
Plugin=WebParser
URL=[MeasureGetLyrics]
StringIndex=1
Substitute="":"Searching...","\n":"#CRLF#"
I have changed the RegExp option and I have inserted another "pattern":"replacement" pair in substitute option.

Let me know if this solves your problem.
User avatar
winterwulf
Posts: 94
Joined: August 17th, 2016, 1:48 am
Location: São Paulo - Brazil

Re: Spotify Lyrics help

Post by winterwulf »

Works Perfectly!

Thank you!

I was able to identify the new pattern on the source of the page, but failed every single time in the webparser sintax =/


thank you so much =)
User avatar
FreeRaider
Posts: 826
Joined: November 20th, 2012, 11:58 pm

Re: Spotify Lyrics help

Post by FreeRaider »

Glad to help :welcome:
User avatar
winterwulf
Posts: 94
Joined: August 17th, 2016, 1:48 am
Location: São Paulo - Brazil

Re: Spotify Lyrics help

Post by winterwulf »

Only a side note:

I think Musixmatch don't wanna people webparsing their content.

After some minutes using the webparser it wont work anymore, unless I change network. Maybe they block the IP or something like this: http://stackoverflow.com/questions/3161548/how-do-i-prevent-site-scraping
User avatar
winterwulf
Posts: 94
Joined: August 17th, 2016, 1:48 am
Location: São Paulo - Brazil

Re: Spotify Lyrics help

Post by winterwulf »

Restarted RM and it worked again...
was getting 12002 fetch error.
User avatar
eclectic-tech
Rainmeter Sage
Posts: 5382
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: Spotify Lyrics help

Post by eclectic-tech »

winterwulf wrote:Restarted RM and it worked again...
was getting 12002 fetch error.
That can happen while testing skins that use webparser if you refresh the skin frequently... Restarting is the solution.

I was curious about the how often this site could find lyrics and created some code you may want to look at to see if any of it is of any use in your project.

This is a will display available lyrics, allow you to scroll in either direction at varying speeds (mousewheel), copy the lyrics to your clipboard (mid-click), or go to the MusixMatch site (left-click).

I modified the substitutes that FreeRaider provided; it will return the entire lyrics and not stop at '/' characters.

Here is some code for you to disect:

Code: Select all

[Rainmeter]
Update=500
AccurateText=1
DynamicWindowSize=1
Group=#RootConfig#

; ========= Metadata ==========
[Metadata]
Name=MusixMatch Lyrics
Author=Eclectic Tech based on work by Minimanx & FreeRaider on RM forum
Information=Will search for lyrics on the MusixMatch website of songs played through the nowplaying plugin and display them in a variable speed scrollable window. You can control the speed & direction by scrolling the mouse, left-click to access www.musixmatch.com, and middle-click to copy lyrics to your clipboard. 
License=Creative Commons Share-Alike NC 4
Version=1.2016.08.31

; ========= Variables ==========
[Variables]
PlayerInterface=WinAmp
go=0
height=400
halfheight=(#height#/2)
width=440

; ========= Measures ==========
[mTitleLyric]
Measure=Plugin
Plugin=NowPlaying.dll
PlayerName=#PlayerInterface#
PlayerType=TITLE
Substitute="":""," ":"-","'":"-",",":"","&":"And","\W+":"-","--":"-"
OnChangeAction=[!CommandMeasure mGetLyrics Update]

[mArtistLyric]
Measure=Plugin
Plugin=NowPlaying.dll
PlayerName=[mTitleLyric]
PlayerType=ARTIST
Substitute="":""," ":"-","'":"-",",":"","&":"And","--":"-"

[mGetLyrics]
Measure=Plugin
Plugin=WebParser
URL=https://www.musixmatch.com/lyrics/[&mArtistLyric]/[&mTitleLyric]
; To see possible translations, add: /translation/{language}  to the end of the URL above
; Replace {language} with Spanish, German, etc. your language (not all are available)
RegExp=(?siU).*"lyrics".*"body":"(.*)","Language"
DynamicVariables=1
FinishAction=[!SetVariable Go 0][!HideMeterGroup Controls][!DisableMeasure measureY][!Update][!EnableMeasure measureY]

[mLyrics]
Measure=Plugin
Plugin=WebParser
URL=[mGetLyrics]
StringIndex=1
DecodeCharacterReference=1
Substitute="":"Searching MusixMatch for Lyrics...","\n":"#CRLF#"

[measurey]
measure=calc
formula=measurey-#go#
dynamicvariables=1

[measureh]
measure=calc
formula=#halfheight#-1-measurey+#halfheight#
dynamicvariables=1

; ================================= Meters ===================================================

[Background]
Meter=Image
W=#width#
H=#height#
SolidColor2=32,32,32,255
SolidColor=32,32,32,210
GradientAngle=90
Hidden=0
AntiAlias=1
DynamicVariables=1
LeftMouseUpAction=["https://www.musixmatch.com/lyrics/[mArtistLyric]/[mTitleLyric]"]
MiddleMouseUpAction=[!SetClip "Title: [mTitleLyric]#CRLF#Artist: [mArtistLyric]#CRLF##CRLF#[mLyrics]"]
MouseOverAction=[!ShowMeterGroup Controls]
MouseLeaveAction=[!HideMeterGroup Controls]
MouseScrollUpAction=[!SetVariable Go (#Go#+2)]
MouseScrollDownAction=[!SetVariable Go (#Go#-2)]
MouseActionCursor=0

[LyricsDisplay]
Meter=STRING
MeterStyle=Style1
MeasureName=mLyrics
X=([Background:W]/2)
W=([Background:W]-20)
Y=([measurey])
H=[measureh]
StringAlign=CENTER
ClipString=2
Text=#CRLF#%1
Hidden=0
Group=Lyric

[TitleAuthor]
Meter=String
MeterStyle=Style1
MeasureName=mTitleLyric
MeasureName2=mArtistLyric
Padding=8,1,8,3
X=(#Width#/2)
Y=2R
SolidColor=32,32,32,255
StringAlign=Center
Text="%1  by  %2"

[Close]
Meter=String
MeterStyle=Style1
X=(#width#-10)
Y=-18r
W=10
Text=X
LeftMouseUpAction=[!DeactivateConfig]
Group=Controls

[Style1]
StringStyle=normal
StringEffect=none
FontFace=Segoe UI
FontSize=10
FontColor=255,255,255
FontEffectColor=0,0,0
AntiAlias=1
DynamicVariables=1
MouseActionCursor=0
Edit: Corrected fontcolor code for [TitleAuthor] section; I was using Win 10 Accent colors, but did not want to have include the SysColor.dll :uhuh: