Deviant Login Shop  Join deviantART for FREE Take the Tour
×

:iconrainmeter: More from Rainmeter


More from deviantART



Details

Submitted on
March 12, 2010
Link
Thumb

Stats

Views
7,708 (15 today)
Favourites
21 (who?)
Comments
10
×

RAINMETER WORKSHOP

Journal Entry: Fri Mar 12, 2010, 6:06 PM
Making a Weather Skin or How I Learned to Stop Worrying and Love Webparser




This is a simple weather skin that shows the current weather using MSN Weather. The other major site used is Yahoo Weather. The measures are from Poiru's upcoming Gnometer suite.

[Rainmeter]
-Same old, same old

[Rainmeter]
Author=Varelse
Update=1000


[Variables]
-The first three variables are used to set your location, hi or lo temperature, and what units the temperature is to be displayed in. weather.LH-valid values for this are Hi or Lo. WeatherCode is the most important variables. It is used to find your location. Go to MSN Weather, and set your location. Look for the little RSS icon on the right. The RSS url will have your WeatherCode in it. The url will look like hxxp://weather.msn.com/RSS.aspx?wealocations=wc:#WeatherCode#&weadegreetype=#TemperatureUnit#. Your WeatherCode is the string between #WeatherCode#. Lastly, TemperatureUnit displays the temperature in Fahrenheit or Celcius; valid values are C or F.

Color=White is part of the path to the weather icons. The filepath to the icons that I'm using is #CURRENTPATH##Color#. #CURRENTPATH# is the filepath to the active skin. In this example the filepath is ..DocumentsRainmeterSkinsTutorialsWeather. #Color# allows me to switch between different folders with different colored icons if I want to change the color of my theme. So the entire filepath ends up being ..DocumentsRainmeterSkinsTutorialsWeatherWhite in this example. If you don't plan on using different color icons you can just dump the weather icons in the folder with the skin .ini ignore using a filepath to the icons.

The rest of the variables are just settings text and background settings.

[Variables]
weather.LH=Lo
WeatherCode=USMO0970
TemperatureUnit=F

FONTCOLOR=200,200,200,220
SIZE=8
SIZE2=15
FONT=Trebuchet MS
WIDTH=150
HEIGHT=25
BGCOLOR=0,0,0,200

Color=White


;===========================
;         MEASURES
;===========================

[MeasureWeather]
-Webparser, the heart every of skin that uses the internet. Update rate sets how often the skin is updated, in this case, once every half hour. Don't set it lower than 900. You don't need to see if your weather is changing faster than that. If you have the update set too low, the sites bandwidth (in this case MSN) will increase dramatically and they will shut down the feed. That's why Accuweather shut down/is going to shut down their Rainmeter weather feed. Because people kept hitting their servers once a second.

Ahem. Url sets the address of the RSS feed. Regexp makes the magic happen. It parses the RSS feed and stores the information as StringIndexes for Rainmeter to use. This regexp actually parses enough information for a 3 day forecast. To find out more about RegExp go here.


[MeasureWeather]
Measure= Plugin
Plugin= PluginsWebParser.dll
UpdateRate=1800
Url=hxxp://weather.msn.com/RSS.aspx?wealocations=wc:#WeatherCode#&weadegreetype=#TemperatureUnit#
RegExp="(?siU)<link>(.*)</link>.*src=".*/(d+).gif".* title="(.*)".*. (.*)&.*src=".*/(d+).gif".* title="(.*)".*#weather.LH#: (.*)&.*src=".*/(d+).gif".* title="(.*)".*#weather.LH#: (.*)&.*src=".*/(d+).gif".* title="(.*)".*#weather.LH#: (.*)&.*</r(.*)s>"


Adding Debug=1 to [MeasureWeather] and activating the log file, we can see what information is stored in what StringIndexes. If you set your WeatherCode and the other two variables correctly you should see something like this in the Log File.

DEBUG: (16:49:32.879) WebParser: (Index 0) [Redacted for personal information]
DEBUG: (16:49:32.879) WebParser: (Index 1) [Redacted for personal information]
DEBUG: (16:49:32.879) WebParser: (Index 2) 11
DEBUG: (16:49:32.879) WebParser: (Index 3) Rain
DEBUG: (16:49:32.879) WebParser: (Index 4) 52
DEBUG: (16:49:32.879) WebParser: (Index 5) 4
DEBUG: (16:49:32.879) WebParser: (Index 6) T-storms
DEBUG: (16:49:32.879) WebParser: (Index 7) 51
DEBUG: (16:49:32.879) WebParser: (Index 8) 11
DEBUG: (16:49:32.879) WebParser: (Index 9) Showers
DEBUG: (16:49:32.879) WebParser: (Index 10) 40
DEBUG: (16:49:32.879) WebParser: (Index 11) 11
DEBUG: (16:49:32.879) WebParser: (Index 12) Rain
DEBUG: (16:49:32.879) WebParser: (Index 13) 38
DEBUG: (16:49:32.879) WebParser: (Index 14) s

[MeasureCIcon]
- is the number code for the current Weather Icon. 5 is the Weather Icon for today's weather. 3 is the description of the Weather, and 4 is the current temperature. The pattern repeats for each different forecast-Current, Today's, Tomorrow's, Day After. Index 14 is used to display the degrees symbol. Url= is the name of the main Webparser measure. Every StringIndex you want to use must be called by a separate measure.

[MeasureCIcon]
Measure= Plugin
Plugin= PluginsWebParser.dll
Url=[MeasureWeather]
StringIndex=2


[MeasureCText]
-Uses StringIndex 3 to display the current weather conditions. It uses a Substitute key to replace a blank space with a N/A if the current weather condition can't be read. Also gets rid of |.

[MeasureCText]
Measure= Plugin
Plugin= PluginsWebParser.dll
Url=[MeasureWeather]
StringIndex=3
Substitute="":"N/A","|":""


[MeasureCText]
-Uses StringIndex 4 to display the current weather temperature.

[MeasureCTemp]
Measure= Plugin
Plugin= PluginsWebParser.dll
Url=[MeasureWeather]
StringIndex=4
Substitute="":"N/A","|":""


[MeasureCText]
-Uses StringIndex 14 to display the degrees symbol.

[MeasureSign]
Measure= Plugin
Plugin= PluginsWebParser.dll
Url=[MeasureWeather]
StringIndex=14
Substitute="s":"°"


;-------STYLES------------

[Text]
-Text style section

[Text]
StringStyle=Bold
StringAlign=Left
FontColor=#FONTCOLOR#
FontSize=#SIZE#
FontFace=#FONT#
AntiAlias=1


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

[BG]
-Background

[BG]
Meter=Image
SolidColor=#BGCOLOR#
X=0
Y=0
H=#HEIGHT#
W=#WIDTH#


[CurrentImage]
-Takes the number from [MeasureCIcon] and displays a corrisponding image. This meter also shows a way to use DynamicVariables to display an image.  If you have your icons in the same folder as the skin's .ini you can just use ImageName=[MeasureCIcon].png.  You'll have to be careful which weather icon pack you use.  Yahoo and MSN use different icon codes.  I like to use Flat Weather Icons by LavAna.

[CurrentImage]
Meter=IMAGE
ImageName=#CURRENTPATH##Color#[MeasureCIcon].png
X=5
Y=0
W=23
H=23
DynamicVariables=1


[CurrentTemp]
-Displays the information for [MeasureCTemp] and [MeasureSign]

[CurrentTemp]
Meter=String
MeasureName=MeasureCTemp
MeasureName2=MeasureSign
X=R
Y=1
FontSize=#SIZE2#
MeterStyle=Text
Text=%1%2


[CurrentConditions]
-Displays the current conditions. There are H and W constraints on this meter to allow for longer text that fits the background.

[CurrentConditions]
Meter=String
MeasureName=MeasureCText
MeterStyle=Text
X=R
Y=r
H=25
W=50
ClipString=1


There you have it, a completed weather skin. Check out the Manual for more information about Meters and Measures.

:iconvarelse42:
Varelse42 reports
CSS originally by alder-sketch
modified by bendenfield
visit the Rainmeter homepage
Add a Comment:
 
:iconhiepnh:
HiepNH Featured By Owner Feb 24, 2014
What stringindex for feel like temperature?
Reply
:iconthecheff4:
thecheff4 Featured By Owner May 6, 2013  Hobbyist General Artist
thanx a lot mate, amazing job
Reply
:iconjadawgis732:
jadawgis732 Featured By Owner Jul 1, 2012
Hey, I know I am about a year late, but where can we find a list of the weather icons and their corresponding numbers?
Reply
:iconflyinghyrax:
FlyingHyrax Featured By Owner Jul 2, 2012
I'm not sure about MSN, but the complete list of Y! Weather condition codes is here: [link]
Reply
:iconcevandri:
Cevandri Featured By Owner Aug 13, 2011
This Guide just saved me countless days of selflearning. THANKS for sharing and Great Job!
Reply
:iconvarelse42:
Varelse42 Featured By Owner Aug 13, 2011
No problem ;)
Reply
:iconbinaryink:
BinaryInk Featured By Owner Mar 13, 2010
I was under the impression that the main problem with accuweather shutting out rainmeter was more because they weren't getting any ad hits from rainmeter users?

Beyond that, great breakdown on how to make a weather meter.
Reply
:iconvarelse42:
Varelse42 Featured By Owner Mar 14, 2010
Kinda of. The bandwidth to ad hits ratio wasn't high enough. It amounts to the same thing really.
Reply
:iconmurasaki55:
murasaki55 Featured By Owner Mar 13, 2010
Thank you for sharing this. :nod:
Reply
:icontaichou-henk:
Taichou-Henk Featured By Owner Mar 12, 2010
Great Job!
Reply
Add a Comment: