It is currently April 27th, 2024, 7:43 am

Weather satellite imagery skin?

Get help with creating, editing & fixing problems with skins
Kyremi
Posts: 41
Joined: September 22nd, 2011, 1:03 pm

Weather satellite imagery skin?

Post by Kyremi »

Hi guys,
I was wondering if anyone's done a satellite image skin? Basically, I think it'd be nice to see the weather patterns on a picture something like this http://www.metoffice.gov.uk/satpics/latest_IR.html... If there's no skin out there, I'd try to make one... would that be similar to an RSS reader feed skin?
User avatar
Kaelri
Developer
Posts: 1721
Joined: July 25th, 2009, 4:47 am

Re: Weather satellite imagery skin?

Post by Kaelri »

That page is actually set up beautifully for downloading with WebParser. Have a look at the source code:

Code: Select all

<script type="text/javascript">
<!--
map.FrameElement[0] = "201109301900.jpg"
map.FrameTags[0] = ["Blank"]
map.FrameElement[1] = "201109302000.jpg"
map.FrameTags[1] = ["Blank"]
map.FrameElement[2] = "201109302100.jpg"
map.FrameTags[2] = ["Blank"]
...
It would be very, very easy to get those filenames from the website, splice together the complete URLs, and then download the images and display them however you want. :)
Kyremi
Posts: 41
Joined: September 22nd, 2011, 1:03 pm

Re: Weather satellite imagery skin?

Post by Kyremi »

Where's that code hiding? I have Firebug (admittedly not used it much) but I couldn't find a match for what you put... then again I'm not sure where to look...

Also I'm very new to Rainmeter coding so I wouldn't know exactly how to start off getting the pictures downloaded; the most I'd know is to use an Image meter, most likely :P
User avatar
Kaelri
Developer
Posts: 1721
Joined: July 25th, 2009, 4:47 am

Re: Weather satellite imagery skin?

Post by Kaelri »

Kyremi wrote:Where's that code hiding? I have Firebug (admittedly not used it much) but I couldn't find a match for what you put... then again I'm not sure where to look...
It's just the page source. Open the page in your browser and press Ctrl-U - should come up.
Kyremi wrote:Also I'm very new to Rainmeter coding so I wouldn't know exactly how to start off getting the pictures downloaded; the most I'd know is to use an Image meter, most likely :P
This page will help you get started on learning the basics of writing/editing skins.
Kyremi
Posts: 41
Joined: September 22nd, 2011, 1:03 pm

Re: Weather satellite imagery skin?

Post by Kyremi »

Ah I see... I got the page code, and so far managed to do this for a skin...

Code: Select all

[Rainmeter]
Update=1000
Author=Kyremi
BackgroundMode=1

;MEASURES---------------------------------------------

[MeasureSomething]
Measure=Plugin
Plugin=Plugins\WebParser.dll
UpdateRate=3600
Url=http://www.metoffice.gov.uk/satpics/latest_IR.html
RegExp=
I've read that tutorial about WebParsing but I'm not sure how to directly apply it to the weather pages, since all I really want (to start off with, anyway) is to grab the latest picture, which is always located at map.FrameElements[23]... it'd go somewhere after RegExp= but the syntax is a bit convoluted...
User avatar
Seahorse
Posts: 1175
Joined: June 9th, 2010, 5:56 pm
Location: Locks heath, UK

Re: Weather satellite imagery skin?

Post by Seahorse »

See the third post in this thread - I have it bookmarked for reference - it breaks the important bits of WebParser down into a couple of easily digestible, colour-coded, chunks that my tiny brain can understand... :twisted:
"Regrettably your planet is one of those scheduled for demolition"
Mike

My Skins at DeviantArt

Kyremi
Posts: 41
Joined: September 22nd, 2011, 1:03 pm

Re: Weather satellite imagery skin?

Post by Kyremi »

Hmm...

Code: Select all

[Rainmeter]
Update=1800
Author=Kyremi
BackgroundMode=1

;MEASURES---------------------------------------------

[MeasureSomething]
Measure=Plugin
Plugin=Plugins\WebParser.dll
UpdateRate=3600
Url=http://www.metoffice.gov.uk/satpics/latest_IR.html
RegExp="(?siU)map.FrameElement[23] = "(.*)"
Download=1

;METERS-----------------------------------------------

[MeterImage]
Meter=Image
MeasureName=MeasureSometing
X=0
Y=0
W=400
H=300
However I get the following errors...
"The meter [MeterImage] cannot be bound with [MeasureSomething]!"
"WebParser: [MeasureSomething] Matching error! (-1)"
"WebParser: [MeasureSomething] The url is empty."

Still confused about the regexp stuff...
User avatar
jsmorley
Developer
Posts: 22631
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Weather satellite imagery skin?

Post by jsmorley »

This actually is just a bit tricky, but doable.

Let's look at how to attack it:

Code: Select all

[Rainmeter]
Update=1800
Author=Kyremi
BackgroundMode=1

;MEASURES---------------------------------------------

[MeasureImages]
Measure=Plugin
Plugin=Plugins\WebParser.dll
UpdateRate=3600
Url=http://www.metoffice.gov.uk/satpics/latest_IR.html
RegExp="(?siU)map.FrameElement\[0\] = "(.*)".*map.FrameElement\[1\] = "(.*)".*"

[MeasureImage0]
Measure=Plugin
Plugin=Plugins\WebParser.dll
UpdateRate=3600
Url=http://www.metoffice.gov.uk/weather/images/eurir_sat_[MeasureImages]
StringIndex=1
Download=1

[MeasureImage1]
Measure=Plugin
Plugin=Plugins\WebParser.dll
UpdateRate=3600
Url=http://www.metoffice.gov.uk/weather/images/eurir_sat_[MeasureImages]
StringIndex=2
Download=1

;METERS-----------------------------------------------

[MeterImage0]
Meter=Image
MeasureName=MeasureImage0
X=0
Y=0
W=400
H=300

[MeterImage1]
Meter=Image
MeasureName=MeasureImage1
X=0
Y=2R
W=400
H=300
So in the parent WebParser measure, [MeasureImages], we want to collect all the image names from that page. I have done just the first two, so you can see how to do it.

RegExp="(?siU)map.FrameElement\[0\] = "(.*)".*map.FrameElement\[1\] = "(.*)".*"

You are saying search for map.FrameElement\[0\] = " (notice that we had to escape the [ and ] characters with a "\" as they are reserved characters in Regular Expression) then capture everything until we hit " Then skip all characters with .* until we hit map.FrameElement\[1\] = " (again escaping the [ and ] characters) until we again hit ". Then we are skipping again with .*, so you could add the rest of the images using the same pattern.

So that measure, [MeasureImages], will have two StringIndexes. One for each of the two image names.

Now... We can't just stick Download=1 on that measure. The measure is just returning image names, not fully formed URL's to the images. Plus, there is more than one anyway. So, we need some "child" measures to get the images down to us.

[MeasureImage0]
Measure=Plugin
Plugin=Plugins\WebParser.dll
UpdateRate=3600
Url=http://www.metoffice.gov.uk/weather/images/eurir_sat_[MeasureImages]
StringIndex=1
Download=1

What this is doing is adding the image name we captured in StringIndex 1 of the parent measure to the base URL http://www.metoffice.gov.uk/weather/images/eurir_sat_ so in effect what we end up with as the URL is:

http://www.metoffice.gov.uk/weather/images/eurir_sat_201110011300.jpg

NOW we can download that with Download=1 and it will be available for an image meter to display.

[MeterImage0]
Meter=Image
MeasureName=MeasureImage0
X=0
Y=0
W=400
H=300

More on how to use "relative paths" with WebParser is Here.

Let me know if you still have questions, we are glad to help.
Kyremi
Posts: 41
Joined: September 22nd, 2011, 1:03 pm

Re: Weather satellite imagery skin?

Post by Kyremi »

Ahh... that helped explain a lot :)

So now I have the images, but they're images from nearly 24 hours ago, and it's impractical to stick 23 pictures onto the desktop at once :P So, I'd want to do something like an RSS reader does with different pages for different feeds, except this would scroll between the different times each picture was taken. Looking at the code in Enigma's reader, it's apparent I'm going to need 23 measures and 23 image meters; it's just the rotating of each one that I'm not quite understanding... I see there are things called Grabbers but I have no idea what they do...?
User avatar
jsmorley
Developer
Posts: 22631
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Weather satellite imagery skin?

Post by jsmorley »

There is no such thing as a "grabber" in Rainmeter, but we can certainly do what you want.

Code: Select all

[Rainmeter]
Update=1800
Author=Kyremi
BackgroundMode=1

;MEASURES---------------------------------------------

[MeasureImages]
Measure=Plugin
Plugin=Plugins\WebParser.dll
UpdateRate=3600
Url=http://www.metoffice.gov.uk/satpics/latest_IR.html
RegExp="(?siU)map.FrameElement\[0\] = "(.*)".*map.FrameElement\[1\] = "(.*)".*map.FrameElement\[2\] = "(.*)".*map.FrameElement\[3\] = "(.*)".*map.FrameElement\[4\] = "(.*)".*map.FrameElement\[5\] = "(.*)".*map.FrameElement\[6\] = "(.*)".*map.FrameElement\[7\] = "(.*)".*map.FrameElement\[8\] = "(.*)".*map.FrameElement\[9\] = "(.*)".*map.FrameElement\[10\] = "(.*)".*map.FrameElement\[11\] = "(.*)".*map.FrameElement\[12\] = "(.*)".*map.FrameElement\[13\] = "(.*)".*map.FrameElement\[14\] = "(.*)".*map.FrameElement\[15\] = "(.*)".*map.FrameElement\[16\] = "(.*)".*map.FrameElement\[17\] = "(.*)".*map.FrameElement\[18\] = "(.*)".*map.FrameElement\[19\] = "(.*)".*map.FrameElement\[20\] = "(.*)".*map.FrameElement\[21\] = "(.*)".*map.FrameElement\[22\] = "(.*)".*map.FrameElement\[23\] = "(.*)".*"

[MeasureImage0]
Measure=Plugin
Plugin=Plugins\WebParser.dll
UpdateRate=3600
Url=http://www.metoffice.gov.uk/weather/images/eurir_sat_[MeasureImages]
StringIndex=1
Download=1
DownloadFile=0.jpg

[MeasureImage1]
Measure=Plugin
Plugin=Plugins\WebParser.dll
UpdateRate=3600
Url=http://www.metoffice.gov.uk/weather/images/eurir_sat_[MeasureImages]
StringIndex=2
Download=1
DownloadFile=1.jpg

[MeasureImage2]
Measure=Plugin
Plugin=Plugins\WebParser.dll
UpdateRate=3600
Url=http://www.metoffice.gov.uk/weather/images/eurir_sat_[MeasureImages]
StringIndex=3
Download=1
DownloadFile=2.jpg

[MeasureImage3]
Measure=Plugin
Plugin=Plugins\WebParser.dll
UpdateRate=3600
Url=http://www.metoffice.gov.uk/weather/images/eurir_sat_[MeasureImages]
StringIndex=4
Download=1
DownloadFile=3.jpg

[MeasureImage4]
Measure=Plugin
Plugin=Plugins\WebParser.dll
UpdateRate=3600
Url=http://www.metoffice.gov.uk/weather/images/eurir_sat_[MeasureImages]
StringIndex=5
Download=1
DownloadFile=4.jpg

[MeasureImage5]
Measure=Plugin
Plugin=Plugins\WebParser.dll
UpdateRate=3600
Url=http://www.metoffice.gov.uk/weather/images/eurir_sat_[MeasureImages]
StringIndex=6
Download=1
DownloadFile=5.jpg

[MeasureImage6]
Measure=Plugin
Plugin=Plugins\WebParser.dll
UpdateRate=3600
Url=http://www.metoffice.gov.uk/weather/images/eurir_sat_[MeasureImages]
StringIndex=7
Download=1
DownloadFile=6.jpg

[MeasureImage7]
Measure=Plugin
Plugin=Plugins\WebParser.dll
UpdateRate=3600
Url=http://www.metoffice.gov.uk/weather/images/eurir_sat_[MeasureImages]
StringIndex=8
Download=1
DownloadFile=7.jpg

[MeasureImage8]
Measure=Plugin
Plugin=Plugins\WebParser.dll
UpdateRate=3600
Url=http://www.metoffice.gov.uk/weather/images/eurir_sat_[MeasureImages]
StringIndex=9
Download=1
DownloadFile=8.jpg

[MeasureImage9]
Measure=Plugin
Plugin=Plugins\WebParser.dll
UpdateRate=3600
Url=http://www.metoffice.gov.uk/weather/images/eurir_sat_[MeasureImages]
StringIndex=10
Download=1
DownloadFile=9.jpg

[MeasureImage10]
Measure=Plugin
Plugin=Plugins\WebParser.dll
UpdateRate=3600
Url=http://www.metoffice.gov.uk/weather/images/eurir_sat_[MeasureImages]
StringIndex=11
Download=1
DownloadFile=10.jpg

[MeasureImage11]
Measure=Plugin
Plugin=Plugins\WebParser.dll
UpdateRate=3600
Url=http://www.metoffice.gov.uk/weather/images/eurir_sat_[MeasureImages]
StringIndex=12
Download=1
DownloadFile=11.jpg

[MeasureImage12]
Measure=Plugin
Plugin=Plugins\WebParser.dll
UpdateRate=3600
Url=http://www.metoffice.gov.uk/weather/images/eurir_sat_[MeasureImages]
StringIndex=13
Download=1
DownloadFile=12.jpg

[MeasureImage13]
Measure=Plugin
Plugin=Plugins\WebParser.dll
UpdateRate=3600
Url=http://www.metoffice.gov.uk/weather/images/eurir_sat_[MeasureImages]
StringIndex=14
Download=1
DownloadFile=13.jpg

[MeasureImage14]
Measure=Plugin
Plugin=Plugins\WebParser.dll
UpdateRate=3600
Url=http://www.metoffice.gov.uk/weather/images/eurir_sat_[MeasureImages]
StringIndex=15
Download=1
DownloadFile=14.jpg

[MeasureImage15]
Measure=Plugin
Plugin=Plugins\WebParser.dll
UpdateRate=3600
Url=http://www.metoffice.gov.uk/weather/images/eurir_sat_[MeasureImages]
StringIndex=16
Download=1
DownloadFile=15.jpg

[MeasureImage16]
Measure=Plugin
Plugin=Plugins\WebParser.dll
UpdateRate=3600
Url=http://www.metoffice.gov.uk/weather/images/eurir_sat_[MeasureImages]
StringIndex=17
Download=1
DownloadFile=16.jpg

[MeasureImage17]
Measure=Plugin
Plugin=Plugins\WebParser.dll
UpdateRate=3600
Url=http://www.metoffice.gov.uk/weather/images/eurir_sat_[MeasureImages]
StringIndex=18
Download=1
DownloadFile=17.jpg

[MeasureImage18]
Measure=Plugin
Plugin=Plugins\WebParser.dll
UpdateRate=3600
Url=http://www.metoffice.gov.uk/weather/images/eurir_sat_[MeasureImages]
StringIndex=19
Download=1
DownloadFile=18.jpg

[MeasureImage19]
Measure=Plugin
Plugin=Plugins\WebParser.dll
UpdateRate=3600
Url=http://www.metoffice.gov.uk/weather/images/eurir_sat_[MeasureImages]
StringIndex=20
Download=1
DownloadFile=19.jpg

[MeasureImage20]
Measure=Plugin
Plugin=Plugins\WebParser.dll
UpdateRate=3600
Url=http://www.metoffice.gov.uk/weather/images/eurir_sat_[MeasureImages]
StringIndex=21
Download=1
DownloadFile=20.jpg

[MeasureImage21]
Measure=Plugin
Plugin=Plugins\WebParser.dll
UpdateRate=3600
Url=http://www.metoffice.gov.uk/weather/images/eurir_sat_[MeasureImages]
StringIndex=22
Download=1
DownloadFile=21.jpg

[MeasureImage22]
Measure=Plugin
Plugin=Plugins\WebParser.dll
UpdateRate=3600
Url=http://www.metoffice.gov.uk/weather/images/eurir_sat_[MeasureImages]
StringIndex=23
Download=1
DownloadFile=22.jpg

[MeasureImage23]
Measure=Plugin
Plugin=Plugins\WebParser.dll
UpdateRate=3600
Url=http://www.metoffice.gov.uk/weather/images/eurir_sat_[MeasureImages]
StringIndex=24
Download=1
DownloadFile=23.jpg

;METERS-----------------------------------------------

[MeasureImageRotate]
Measure=Calc
Formula=Counter % 24

[MeterImage0]
Meter=Image
ImageName=#CURRENTPATH#DownloadFile\[MeasureImageRotate].jpg
X=0
Y=0
W=400
H=300
DynamicVariables=1
The bad news is that you indeed will need 24 "child" measures to get each of the images from 0 to 23. The good news is that you only need one meter to display it.

Let's look at what I did...

Here is our first "child" measure. The others all follow the same pattern, and just can be copy/pasted and the names, StringIndexes, and image names changed for each.

[MeasureImage0]
Measure=Plugin
Plugin=Plugins\WebParser.dll
UpdateRate=3600
Url=http://www.metoffice.gov.uk/weather/images/eurir_sat_[MeasureImages]
StringIndex=1
Download=1
DownloadFile=0.jpg

So what I am doing is getting that image, and saving it in a folder under the skin called \DownloadFile as "0.jpg".

I do this for all 24 images... 0.jpg to 23.jpg

Now we need a way to "rotate" those images in one meter. So first we build a Calc measure that counts from 0 to 23.

[MeasureImageRotate]
Measure=Calc
Formula=Counter % 24

Then we have our display meter, which uses the value of that [MeasureImageRotate] Calc measure to set the file name. Notice that we don't have any MeasureName= at all, just go get the images right from that DownloadFile folder.

[MeterImage0]
Meter=Image
ImageName=#CURRENTPATH#DownloadFile\[MeasureImageRotate].jpg
X=0
Y=0
W=400
H=300
DynamicVariables=1

Bob's your uncle...

Note: You can change the rate at which they are rotated by changing the Update= setting in [Rainmeter]. Be a bit careful about making it too "fast", as this skin already works pretty hard with 24 720x576 images, and if you ramp up the speed it may use a lot of CPU.