It is currently April 20th, 2024, 9:46 am

Weather skin with error

Get help with creating, editing & fixing problems with skins
OzPT
Posts: 5
Joined: October 21st, 2014, 1:08 am

Weather skin with error

Post by OzPT »

Hi,

I'm having an error with my weather skin.
I'm using MSN Weather to get de Data.
I think the problem is that my file is fetching the info from MSN and the page has change.
How can I change so that my file collects data from weather.com.
I'm using this skin: http://customize.org/rainmeter/skins/69720

This is the error that I'm getting everytime I load the skin:
ERRO (00:30:31.405) Weather\LEXIS-Weather.ini - [SOURCE]: WebParser: RegExp matching error (-1)

http://imgur.com/8dPYmnH

Thanks in advance,
Oz
User avatar
balala
Rainmeter Sage
Posts: 16148
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Weather skin with error

Post by balala »

Instead of what is used in that skin, you could try to parse an xml file. That's better, because its structure never changes, while a website's structure often does. For example, here's a simple code:

Code: Select all

[Rainmeter]
Update=1000
DynamicWindowSize=1

[Variables]
Location=
Metric=

[MeasureCurrentConditions]
Measure=Plugin
Plugin=Plugins\WebParser.dll
UpdateRate=3000
Url=http://xml.weather.com/weather/local/#Location#?cc=*&unit=#Metric#&dayf=0
RegExp="(?siU).*<locale>(.*)</locale>.*<ut>(.*)</ut>.*<ud>(.*)</ud>.*<us>(.*)</us>.*<up>(.*)</up>.*<ur>(.*)</ur>.*<loc id="(.*)">.*<dnam>(.*)</dnam>.*<tm>(.*)</tm>.*<lat>(.*)</lat>.*<lon>(.*)</lon>.*<sunr>(.*)</sunr>.*<suns>(.*)</suns>.*<zone>(.*)</zone>.*<cc>.*<lsup>(.*)</lsup>.*<obst>(.*)</obst>.*<tmp>(.*)</tmp>.*<flik>(.*)</flik>.*<t>(.*)</t>.*<icon>(.*)</icon>.*<bar>.*<r>(.*)</r>.*<d>(.*)</d>.*<wind>.*<s>(.*)</s>.*<gust>(.*)</gust>.*<d>(.*)</d>.*<t>(.*)</t>.*<hmid>(.*)</hmid>.*<vis>(.*)</vis>.*<uv>.*<i>(.*)</i>.*<t>(.*)</t>.*<dewp>(.*)</dewp>.*<moon>.*<icon>(.*)</icon>.*<t>(.*)</t>.*"

[MeasureWeatherTemp]
Measure=Plugin
Plugin=Plugins\WebParser.dll
Url=[MeasureCurrentConditions]
StringIndex=17

[MeasureWeatherDesc]
Measure=Plugin
Plugin=Plugins\WebParser.dll
Url=[MeasureCurrentConditions]
StringIndex=19
Substitute=" And ":" and ","Lgt.":"Light ","Snow/":"Snow & "

[MeasureWeatherIcon]
Measure=Plugin
Plugin=Plugins\WebParser.dll
Url=[MeasureCurrentConditions]
StringIndex=20

[MeasureWeatherRealFeel]
Measure=Plugin
Plugin=Plugins\WebParser.dll
Url=[MeasureCurrentConditions]
StringIndex=18

[Uptime]
MeasureName=MeasureWeatherTemp
MeasureName2=MeasureWeatherDesc
MeasureName3=MeasureWeatherIcon
MeasureName4=MeasureWeatherRealFeel
Meter=STRING
X=0
Y=0
FontColor=220,220,220
SolidColor=0,0,0
FontSize=10
FontFace=Segoe UI
StringStyle=BOLD
StringAlign=LEFT
AntiAlias=1
Text=Current temperature: %1#CRLF#Condition: %2#CRLF#Icon: %3#CRLF#Real feeling: %4
Obviously this is a very basic skin, it provides just the current temperature, the weather condition, a number which can be used to display an icon and the temperature corresponding to the real feeling. There's a long way to have all the data you need, but I think this is a good start to work on. If you can't develope the whole code, let me know and I'll work on it a bit.
Befor you try the code, don't forget to add in the Variable section, the location and metric variables, other way the skin won't work!
OzPT
Posts: 5
Joined: October 21st, 2014, 1:08 am

Re: Weather skin with error

Post by OzPT »

Hi balala,

I tried your code and it works.
But I would like to use the images from that skin, and using the RegExp instead of the one from the skin, it doesnt get the images.
I dont understand xml, but I was able to get your code into the skin by only adding the variables, RegExp and the url's.
Can you help me build the RegExp code so that it gets the images from the skin?

Thank you for yout help. :bow:
Oz
User avatar
balala
Rainmeter Sage
Posts: 16148
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Weather skin with error

Post by balala »

You'll have to add an image meter to the skin. I adapted my previous code a bit, adding this meter:

Code: Select all

[Rainmeter]
Update=1000
BackgroundMode=2
SolidColor=80,80,80,220
DynamicWindowSize=1

[Variables]
Location=ROXX0035
Metric=m

[MeasureCurrentConditions]
Measure=Plugin
Plugin=Plugins\WebParser.dll
UpdateRate=3000
Url=http://xml.weather.com/weather/local/#Location#?cc=*&unit=#Metric#&dayf=0
RegExp="(?siU).*<locale>(.*)</locale>.*<ut>(.*)</ut>.*<ud>(.*)</ud>.*<us>(.*)</us>.*<up>(.*)</up>.*<ur>(.*)</ur>.*<loc id="(.*)">.*<dnam>(.*)</dnam>.*<tm>(.*)</tm>.*<lat>(.*)</lat>.*<lon>(.*)</lon>.*<sunr>(.*)</sunr>.*<suns>(.*)</suns>.*<zone>(.*)</zone>.*<cc>.*<lsup>(.*)</lsup>.*<obst>(.*)</obst>.*<tmp>(.*)</tmp>.*<flik>(.*)</flik>.*<t>(.*)</t>.*<icon>(.*)</icon>.*<bar>.*<r>(.*)</r>.*<d>(.*)</d>.*<wind>.*<s>(.*)</s>.*<gust>(.*)</gust>.*<d>(.*)</d>.*<t>(.*)</t>.*<hmid>(.*)</hmid>.*<vis>(.*)</vis>.*<uv>.*<i>(.*)</i>.*<t>(.*)</t>.*<dewp>(.*)</dewp>.*<moon>.*<icon>(.*)</icon>.*<t>(.*)</t>.*"

[MeasureWeatherTemp]
Measure=Plugin
Plugin=Plugins\WebParser.dll
Url=[MeasureCurrentConditions]
StringIndex=17

[MeasureWeatherDesc]
Measure=Plugin
Plugin=Plugins\WebParser.dll
Url=[MeasureCurrentConditions]
StringIndex=19
Substitute=" And ":" and ","Lgt.":"Light ","Snow/":"Snow & "

[MeasureWeatherIcon]
Measure=Plugin
Plugin=Plugins\WebParser.dll
Url=[MeasureCurrentConditions]
StringIndex=20

[MeasureWeatherRealFeel]
Measure=Plugin
Plugin=Plugins\WebParser.dll
Url=[MeasureCurrentConditions]
StringIndex=18

[MeterDatas]
MeasureName=MeasureWeatherTemp
MeasureName2=MeasureWeatherDesc
MeasureName3=MeasureWeatherIcon
MeasureName4=MeasureWeatherRealFeel
Meter=STRING
X=0
Y=0
FontColor=220,220,220
FontSize=10
FontFace=Segoe UI
StringStyle=BOLD
StringAlign=LEFT
AntiAlias=1
Text=Current temperature: %1#CRLF#Condition: %2#CRLF#Icon: %3#CRLF#Real feeling: %4

[MeterWeatherIcon]
Meter=IMAGE
ImageName=#@#Images\[MeasureWeatherIcon].png
X=10
Y=75
DynamicVariables=1
Copy the Images folder from your old skin folder, into the Resource folder of the new skin. Also you'll have to verify if the icon numbers returned by the old skin are corresponding with the icon numbers returned by the new one. Right now, for me the skin indicates as current condition Mist, and as icon, number 20. The Images\20.png icon can be (is?) the mist's icon. I think, but I'm not really sure, that the returned numbers must be the same, no mater what weather provider are you using. Maybe someone why knows, can tell us if I'm right. If so, than the corespondence between the old and the new skin is ok, otherwise you'll have to verify and rename the png files into the Images folder, acording to the values returned by [MeasureWeatherIcon].
Please let me know if you could update the skin.
OzPT
Posts: 5
Joined: October 21st, 2014, 1:08 am

Re: Weather skin with error

Post by OzPT »

Hi,

Sorry for the late responseee, but I've been busy with work :(.
I tried your code and is getting an error:

ERROR (04:01:20.231) Weather\LEXIS-Weather.ini: ImageName: Unable to open: C:\Users\Asus\Documents\Rainmeter\Skins\Weather\@Resources\Images\.png

But, I was able to find a skin that is working and change it according to my style.
Now everything is working fine.
Thank you for your help.
User avatar
balala
Rainmeter Sage
Posts: 16148
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Weather skin with error

Post by balala »

OzPT wrote:ERROR (04:01:20.231) Weather\LEXIS-Weather.ini: ImageName: Unable to open: C:\Users\Asus\Documents\Rainmeter\Skins\Weather\@Resources\Images\.png
What's returned by the [MeasureWeatherIcon] measure? Use my posted code and see what it shows in the Icon: line:
Image
OzPT
Posts: 5
Joined: October 21st, 2014, 1:08 am

Re: Weather skin with error

Post by OzPT »

It doesn't show anything.

It's like this:
Current temperature:17 (in my location)
Condition: N/A
Icon: (no value)
Real Feeling: 17
User avatar
balala
Rainmeter Sage
Posts: 16148
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Weather skin with error

Post by balala »

OzPT wrote:Icon: (no value)
Strange, because for me the [MeasureWeatherIcon] measure returns a value! All measures returns proper values, except this one, I don't know why! Could you check the code to see if you have StringIndex=20 on [MeasureWeatherIcon]? For now, I don't have other idea.
User avatar
moshi
Posts: 1740
Joined: November 13th, 2012, 9:53 pm

Re: Weather skin with error

Post by moshi »

the condition is "N/A", not available.
maybe weather.com does not specify an icon for a "not available" weather condition.

solution: find an icon in the skins folder that represents "not available" or create one.
then add this to [MeasureWeatherIcon]

Code: Select all

Substitute="":"whatevernumberyouhavechosen"
User avatar
balala
Rainmeter Sage
Posts: 16148
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Weather skin with error

Post by balala »

If moshi's right, then after a while the measure should return a value. Check it to see if it does. If yes, his solution is a good one, if not, somthing else is happening.