It is currently October 27th, 2020, 4:01 am

Album Art

Help with creating, editing & fixing problems with skins
User avatar
JamX
Posts: 184
Joined: October 4th, 2019, 2:46 pm

Album Art

Post by JamX »

Normally I have a skin for spotify with "WebNowPlaying" to get the Artist/track info and the album art.

Now I wanted to try to use NowPlaying plugin.
I do not need the repeat / shuffle function but I would like to have the album art!

To get the album art I was planning to use Last.fm API. It's free of use so I registered and got the API key.

Then I started RainRegExp for the parsing and used:
URL: http://ws.audioscrobbler.com/2.0/?method=track.getinfo&api_key=4e7773d5b02916ac17a5f95fdd604xxx&artist=Beach House&track=Lazuli
(note: the last 3 numbers of the API key are replaced by xxx)
and
Regexp: (?siU)<image size="medium">(.*)</image>

This gives me the string of the album art URL: 1 => https://lastfm.freetls.fastly.net/i/u/64s/90ff02d4495f4c50a1b7b2a64798d892.png
Capture1.JPG
When I insert this URL in EDGE I see the album art displayed.
Capture2.JPG

OK this is working I thought...so I started coding in rainmeter as follows:

Code: Select all

[Rainmeter]
update=1000

[Variables]

Artist=
Track=
ArtURL=https://lastfm.freetls.fastly.net/i/u/64s/90ff02d4495f4c50a1b7b2a64798d892.png

fontface=Verdana
stringstyle=normal
stringeffect=none
stringalign=right 
fontcolor=ffffff 
fonteffectcolor=000000

--------------------- Measures

[MeasureArtist]
Measure=Plugin
Plugin=NowPlaying.dll 
PlayerName=Spotify
PlayerType=ARTIST
Substitute="":"N\A"

[MeasureTrack]
Measure=Plugin
Plugin=NowPlaying.dll
PlayerName=Spotify
PlayerType=TITLE
Substitute="":"N\A"
OnChangeAction=[!SetVariable Artist "[MeasureArtist]"][!SetVariable Track "[MeasureTrack]"][!CommandMeasure MeasureGetArtURL "UpDate"]

[MeasureGetArtURL]
;UpdateDivider=-1
Measure=WebParser
Url=http://ws.audioscrobbler.com/2.0/?method=track.getinfo&api_key=4e7773d5b02916ac17a5f95fdd604xxx&artist=#Artist#&track=#Track#
RegExp=(?siU)<image size="medium">(.*)</image>
StringIndex=1
FinishAction=[!SetVariable ArtURL "[MeasureGetArtURL]"][!CommandMeasure MeasureGetArt "Update"]
DynamicVariables=1

[MeasureGetArt]
UpdateRate=-1
Measure=WebParser
URL=#ArtURL#
Download=1
DynamicVariables=1

------------- Meters

[MeterArt]
Meter=IMAGE
MeasureName=MeasureGetArt
ImageRotate=-20
X=300
Y=58
H=159
W=159
antialias=1
Tile=0
PreserveAspectRatio=2
SolidColor=0,0,0,200

[MeterTrack]
Meter=STRING
StringAlign=#stringalign#
MeasureName=MeasureTrack
X=-5r
Y=r
FontColor=#fontcolor#
fonteffectcolor=#fonteffectcolor#
stringeffect=#stringeffect#
stringstyle=#stringstyle#
FontSize=14
FontFace=#fontface#
AntiAlias=1

[MeterArtist]
Meter=STRING
StringAlign=#stringalign#
MeasureName=MeasureArtist
X=r
Y=40r
FontColor=#fontcolor#
fonteffectcolor=#fonteffectcolor#
stringeffect=#stringeffect#
stringstyle=#stringstyle#
stringcase=upper
FontSize=12
FontFace=#fontface#
AntiAlias=1
dynamicvariables=1

But somehow I do not get the MeasureGetArtURL string
Capture3.JPG
Anybody an idea what I'm doing wrong?
You do not have the required permissions to view the files attached to this post.
User avatar
Yincognito
Posts: 2817
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Album Art

Post by Yincognito »

JamX wrote: September 10th, 2020, 1:48 pm Normally I have a skin for spotify with "WebNowPlaying" to get the Artist/track info and the album art.

Now I wanted to try to use NowPlaying plugin.
I do not need the repeat / shuffle function but I would like to have the album art!

To get the album art I was planning to use Last.fm API. It's free of use so I registered and got the API key.

Then I started RainRegExp for the parsing and used:
URL: http://ws.audioscrobbler.com/2.0/?method=track.getinfo&api_key=4e7773d5b02916ac17a5f95fdd604xxx&artist=Beach House&track=Lazuli
(note: the last 3 numbers of the API key are replaced by xxx)
and
Regexp: (?siU)<image size="medium">(.*)</image>

This gives me the string of the album art URL: 1 => https://lastfm.freetls.fastly.net/i/u/64s/90ff02d4495f4c50a1b7b2a64798d892.png
Capture1.JPG

When I insert this URL in EDGE I see the album art displayed.
Capture2.JPG


OK this is working I thought...so I started coding in rainmeter as follows:

Code: Select all

[Rainmeter]
update=1000

[Variables]

Artist=
Track=
ArtURL=https://lastfm.freetls.fastly.net/i/u/64s/90ff02d4495f4c50a1b7b2a64798d892.png

fontface=Verdana
stringstyle=normal
stringeffect=none
stringalign=right 
fontcolor=ffffff 
fonteffectcolor=000000

--------------------- Measures

[MeasureArtist]
Measure=Plugin
Plugin=NowPlaying.dll 
PlayerName=Spotify
PlayerType=ARTIST
Substitute="":"N\A"

[MeasureTrack]
Measure=Plugin
Plugin=NowPlaying.dll
PlayerName=Spotify
PlayerType=TITLE
Substitute="":"N\A"
OnChangeAction=[!SetVariable Artist "[MeasureArtist]"][!SetVariable Track "[MeasureTrack]"][!CommandMeasure MeasureGetArtURL "UpDate"]

[MeasureGetArtURL]
;UpdateDivider=-1
Measure=WebParser
Url=http://ws.audioscrobbler.com/2.0/?method=track.getinfo&api_key=4e7773d5b02916ac17a5f95fdd604xxx&artist=#Artist#&track=#Track#
RegExp=(?siU)<image size="medium">(.*)</image>
StringIndex=1
FinishAction=[!SetVariable ArtURL "[MeasureGetArtURL]"][!CommandMeasure MeasureGetArt "Update"]
DynamicVariables=1

[MeasureGetArt]
UpdateRate=-1
Measure=WebParser
URL=#ArtURL#
Download=1
DynamicVariables=1

------------- Meters

[MeterArt]
Meter=IMAGE
MeasureName=MeasureGetArt
ImageRotate=-20
X=300
Y=58
H=159
W=159
antialias=1
Tile=0
PreserveAspectRatio=2
SolidColor=0,0,0,200

[MeterTrack]
Meter=STRING
StringAlign=#stringalign#
MeasureName=MeasureTrack
X=-5r
Y=r
FontColor=#fontcolor#
fonteffectcolor=#fonteffectcolor#
stringeffect=#stringeffect#
stringstyle=#stringstyle#
FontSize=14
FontFace=#fontface#
AntiAlias=1

[MeterArtist]
Meter=STRING
StringAlign=#stringalign#
MeasureName=MeasureArtist
X=r
Y=40r
FontColor=#fontcolor#
fonteffectcolor=#fonteffectcolor#
stringeffect=#stringeffect#
stringstyle=#stringstyle#
stringcase=upper
FontSize=12
FontFace=#fontface#
AntiAlias=1
dynamicvariables=1

But somehow I do not get the MeasureGetArtURL string
Capture3.JPG

Anybody an idea what I'm doing wrong?
It's difficult to test if we don't know how the source looks like, but in the screenshot you posted, the artist and track variables (which you use in the URL) are empty, despite their source measures being not, so this might give you a starting point in identifying the culprit.
User avatar
JamX
Posts: 184
Joined: October 4th, 2019, 2:46 pm

Re: Album Art

Post by JamX »

I have the correct regexp as you can see in the image above.
Strange thing to me is that I do not see the string of the url in Rainmeter webparser.
The variables artiest and track are set when the track change and even then I do not see the string.

But do not worry. I have it running now but I see that last.fm cover art is app 80% of the songs i'm listening. This is to low hitrate for me so I stoppen coding for this and stay at webnowplaying for Spotify.
dvo
Posts: 1017
Joined: February 7th, 2016, 6:08 am

Re: Album Art

Post by dvo »

normaly we grab the info and work with it but could not use the key to get the info ... it's always trail and error... :Whistle
User avatar
JamX
Posts: 184
Joined: October 4th, 2019, 2:46 pm

Re: Album Art

Post by JamX »

dvo wrote: September 11th, 2020, 11:50 am normaly we grab the info and work with it but could not use the key to get the info ... it's always trail and error... :Whistle
You could also register and get your own free api key to use and test 8-)
User avatar
Yincognito
Posts: 2817
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Album Art

Post by Yincognito »

JamX wrote: September 11th, 2020, 11:39 amBut do not worry. I have it running now but I see that last.fm cover art is app 80% of the songs i'm listening. This is to low hitrate for me so I stoppen coding for this and stay at webnowplaying for Spotify.
Yep, it's hard to find something about music that will have a comprehensive database. Even if it would, it would be mostly for songs in English, and adding dozens of other sources for "localized" content isn't really a brilliant idea... :confused:
dvo
Posts: 1017
Joined: February 7th, 2016, 6:08 am

Re: Album Art

Post by dvo »

You could also register and get your own free api key to use and test
why should i? tell me y :D
User avatar
JamX
Posts: 184
Joined: October 4th, 2019, 2:46 pm

Re: Album Art

Post by JamX »

dvo wrote: September 11th, 2020, 2:58 pm why should i? tell me y :D
The Challange
dvo
Posts: 1017
Joined: February 7th, 2016, 6:08 am

Re: Album Art

Post by dvo »

nope i only do that for things i use... :rolmfao: :-( The Challange or do you think i could not fill out a form :rofl:
User avatar
JamX
Posts: 184
Joined: October 4th, 2019, 2:46 pm

Re: Album Art

Post by JamX »

For those who are interested this is the code:

Code: Select all

[Rainmeter]
update=60

[Variables]

fontface=Verdana
stringstyle=normal
stringeffect=none
stringalign=right 
fontcolor=ffffff 
fonteffectcolor=000000

--------------------- Measures

[MeasureArtist]
Measure=NowPlaying
PlayerName=Spotify
PlayerType=ARTIST
Substitute="":"N\A"

[MeasureTrack]
Measure=NowPlaying
PlayerName=Spotify
PlayerType=TITLE
Substitute="":"N\A"
OnChangeAction=[!CommandMeasure MeasureGetArt "UpDate"]

[MeasureGetArt]
Measure=WebParser
Url=http://ws.audioscrobbler.com/2.0/?method=track.getinfo&api_key=4e7773d5b02916ac17a5f95fdd604xxx&artist=[&MeasureArtist]&track=[&MeasureTrack]
RegExp=(?siU)<image size="large">(.*)</image>
StringIndex=1
Substitute="":"#CURRENTPATH#no_cover_itunes_by_stainless2.png"
FinishAction=[!Redraw]
DynamicVariables=1
ForceReload=1
Download=1

------------- Meters

 [MeterArt]
Meter=IMAGE
MeasureName=MeasureGetArt
X=300
Y=58
H=159
W=159
antialias=1
Tile=0
PreserveAspectRatio=2
SolidColor=0,0,0,200

[MeterTrack]
Meter=STRING
StringAlign=#stringalign#
MeasureName=MeasureTrack
X=-5r
Y=r
FontColor=#fontcolor#
fonteffectcolor=#fonteffectcolor#
stringeffect=#stringeffect#
stringstyle=#stringstyle#
FontSize=14
FontFace=#fontface#
AntiAlias=1

[MeterArtist]
Meter=STRING
StringAlign=#stringalign#
MeasureName=MeasureArtist
X=r
Y=40r
FontColor=#fontcolor#
fonteffectcolor=#fonteffectcolor#
stringeffect=#stringeffect#
stringstyle=#stringstyle#
stringcase=upper
FontSize=12
FontFace=#fontface#
AntiAlias=1
dynamicvariables=1
Just register at last.fm and get your own API key for free and past that key into the code: