It is currently June 18th, 2024, 8:09 am

Splitting a String returned in a Measure

Get help with creating, editing & fixing problems with skins
Phill
Posts: 3
Joined: August 27th, 2010, 3:15 pm

Splitting a String returned in a Measure

Post by Phill »

This might be an incredibly stupid question but I have checked the manual and can't seem to find an answer...

Overall I am attempting to create a Spotify Skin that will also display Album Art using the search at last.fm. The plan is:
1. Take the Artist and Title from Spotify retrieved using the WindowMessagePlugin and WindowClass=SpotifyMainWindow
2. Split the String on the " - "
3. Search last.fm using http://ws.audioscrobbler.com/2.0/?method=track.getinfo&api_key=b25b959554ed76058ac220b7b2e0a026&artist=#ARTIST#&track=#TRACK#
4. Then using the WebParser pull out the link to the album art and display it within the Skin.

Without being able to fully test it I'm also unsure how to use the returned string in the ImageName field.

The RegExp query should be fairly simple - but I'm stuck at the first hurdle. I'm new to Rainmeter and am not sure if I can use a RegExp within a Measure on the output from WindowClass (can't seem to make it work).

Any help would would be appreciated.

Cheers.

EDIT: What I have so far:

Code: Select all

[Variables]
Artist=???
Track=???
TrackURL=http://ws.audioscrobbler.com/2.0/?method=track.getinfo&api_key=b25b959554ed76058ac220b7b2e0a026&artist=#ARTIST#&track=#TRACK#

[MeasureAlbumArt]
Measure=Plugin
Plugin=Plugins\WebParser.dll
UpdateRate=1000
Url=#TrackURL#
RegExp="(?siU)<image size="medium">"(.*)"</image>.*"
StringIndex=1

[MeterAlbumArt]
MeasureName=MeasureAlbumArt
Meter=Image
ImageName=???
User avatar
Alex2539
Rainmeter Sage
Posts: 642
Joined: July 19th, 2009, 5:59 am
Location: Montreal, QC, Canada

Re: Splitting a String returned in a Measure

Post by Alex2539 »

Unfortunately numbers 2 and 3 are not possible. RegExp is only available with the WepParser plugin and as such there is no real way to split up a string from another measure. Even if you could split it up, the only way to modify the URL to get the album art would be to use dynamic variables. Unfortunately, plugins cannot use dynamic variables. Since WebParser is a plugin, this means that the URL cannot be changed while the skin is running.

There are probably workarounds to get this to work, but it would become very, very complicated very quickly.
ImageImageImageImage
User avatar
Chewtoy
Moderator
Posts: 995
Joined: June 10th, 2009, 12:44 pm
Location: Sweden

Re: Splitting a String returned in a Measure

Post by Chewtoy »

Alex2539 wrote:...the only way to modify the URL to get the album art would be to use dynamic variables. Unfortunately, plugins cannot use dynamic variables. Since WebParser is a plugin, this means that the URL cannot be changed while the skin is running.
We do have a new !Bang that will help with this though. Take a look at !RainmeterWriteKeyValue and jsmorleys silly skin on using it.
You will need to refresh the skin before it does it's job, but that's a small thing.

But as Alex said, it will get complicated.
I don't think, therefore I'm not.