It is currently April 18th, 2024, 11:11 am
Get help with creating, editing & fixing problems with skins
CyberTheWorm
Posts: 860 Joined: August 22nd, 2016, 11:32 pm
Location: Surrey, B.C., Canada
Post
by CyberTheWorm » February 21st, 2017, 7:45 am
OK so I'm doing a weather skin, got all the values I was looking for but it will not display the data?
Am I missing something? I know the code is not elegant but I'm just learning this stuff.
Capture2.PNG
Capture.PNG
Code: Select all
[Rainmeter]
Update=-1
AccurateText=1
[Metadata]
[Variables]
; LocationCode can be obtained at http://wxdata.weather.com/wxdata/search/search?where=YourCityName
LocationCode=CAXX0485
; UnitOfMeasure can be "i" (Imperial / Fahrenheit) or "m" (Metric / Celsius)
UnitOfMeasure=m
; Number of days to return in the feed.(1-6)
DaysFeed=1
; Locale (language) to use in the feed.
; https://msdn.microsoft.com/en-us/goglobal/bb896001.aspx
; Note that Weather.com uses "_" underline instead of "-" dash in the codes.
Locale=en_US
WebSite=https://wxdata.weather.com/wxdata/weather/local/#LocationCode#?cc=*&unit=#UnitOfMeasure#&dayf=#DaysFeed#&locale=#Locale#
; =======================================
; Measures
; =======================================
[MeasureTemp]
Measure=Plugin
Plugin=WebParser
URL=#WebSite#
RegExp=(?siU)<tmp>(.*)</tmp>
[MeasureFeelsLike]
Measure=Plugin
Plugin=WebParser
URL=#WebSite#
RegExp=(?siU)<flik>(.*)</flik>
[MeasureSunRise]
Measure=Plugin
Plugin=WebParser
URL=#WebSite#
RegExp=(?siU)<sunr>(.*)</sunr>
[MeasureSunSet]
Measure=Plugin
Plugin=WebParser
URL=#WebSite#
RegExp=(?siU)<suns>(.*)</suns>
[MeasureCurrentTemp]
Measure=Plugin
Plugin=WebParser
URL=[MeasureTemp]
StringIndex=1
[MeasureFeelsLikeTemp]
Measure=Plugin
Plugin=WebParser
URL=[MeasureFeelsLike]
StringIndex=1
[MeasureCurrentSunRise]
Measure=Plugin
Plugin=WebParser
URL=[MeasureSunRise]
StringIndex=1
[MeasureCurrentSunSet]
Measure=Plugin
Plugin=WebParser
URL=[MeasureSunSet]
StringIndex=1
; =======================================
; Meters
; =======================================
[MeterBackground]
Meter=Shape
Shape=Rectangle 0,0,200,120,2,2 | Fill color 127,127,127,255 | StrokeWidth 2 | Stroke Color 200,200,200,255
X=1
Y=1
[MeterTempLabel]
Meter=String
X=50
Y=5
FontFace=Ariel
FontSize=10
FontColor=255,255,255,255
AntiAlias=1
StringAlign=Center
StringEffect=Shadow
FontEffectColor=0,0,0,255
Text=Current Temp:
[MeterTemp]
Meter=String
MeasureName=MeasureCurrentTemp
X=180
Y=0r
FontFace=Ariel
FontSize=10
FontColor=255,255,255,255
AntiAlias=1
StringAlign=Right
StringEffect=Shadow
FontEffectColor=0,0,0,255
Text=%1 C
You do not have the required permissions to view the files attached to this post.
Last edited by CyberTheWorm on February 21st, 2017, 10:08 am, edited 1 time in total.
fonpaolo
Moderator
Posts: 1387 Joined: April 11th, 2013, 8:08 pm
Location: Italy
Post
by fonpaolo » February 21st, 2017, 8:46 am
What you're trying to obtain it's a little more complicate...
This is the code I'm currently using:
1- a measure using the link to the weather xml, with location code, number of days for forecast and unit of measures, it downloads all;
Code: Select all
[MeasureWeather]
Measure=Plugin
Plugin=WebParser
Url=#WebSite#
RegExp=(?siU)^(.*)$
UpdateRate=1800
2-
a measure, using the downloaded data to parse all the informations you want , as this:
Code: Select all
[MeasureBase]
Measure=Plugin
Plugin=WebParser
Url=[MeasureWeather]
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>.*<ppcp>(.*)</ppcp>.*
Substitute="":"-1"
[MeasureToday]
Measure=Plugin
Plugin=WebParser
Url=[MeasureWeather]
RegExp=(?siU)<dayf>.*<lsup>(.*)</lsup>.*<day d="0" t="(.*)" dt="(.*)".*<hi>(.*)</hi>.*<low>(.*)</low>.*<sunr>(.*)</sunr>.*<suns>(.*)</suns>(?(?=.*<part p="d">).*<icon>(.*)</icon>.*<t>(.*)</t>.*<wind>.*<s>(.*)</s>.*<gust>(.*)</gust>.*<d>(.*)</d>.*<t>(.*)</t>.*<bt>(.*)</bt>.*<ppcp>(.*)</ppcp>.*<hmid>(.*)</hmid>)(?(?=.*<part p="n">).*<icon>(.*)</icon>.*<t>(.*)</t>.*<wind>.*<s>(.*)</s>.*<gust>(.*)</gust>.*<d>(.*)</d>.*<t>(.*)</t>.*<bt>(.*)</bt>.*<ppcp>(.*)</ppcp>.*<hmid>(.*)</hmid>.*)
Substitute="":"-1"
[MeasureForecastDay1]
Measure=Plugin
Plugin=WebParser
Url=[MeasureWeather]
RegExp=(?siU)<day d="1" t="(.*)" dt="(.*)".*<hi>(.*)</hi>.*<low>(.*)</low>.*<sunr>(.*)</sunr>.*<suns>(.*)</suns>(?(?=.*<part p="d">).*<icon>(.*)</icon>.*<t>(.*)</t>.*<wind>.*<s>(.*)</s>.*<gust>(.*)</gust>.*<d>(.*)</d>.*<t>(.*)</t>.*<bt>(.*)</bt>.*<ppcp>(.*)</ppcp>.*<hmid>(.*)</hmid>)(?(?=.*<part p="n">).*<icon>(.*)</icon>.*<t>(.*)</t>.*<wind>.*<s>(.*)</s>.*<gust>(.*)</gust>.*<d>(.*)</d>.*<t>(.*)</t>.*<bt>(.*)</bt>.*<ppcp>(.*)</ppcp>.*<hmid>(.*)</hmid>.*)
Substitute="":"-1"
[MeasureForecastDay2]
Measure=Plugin
Plugin=WebParser
Url=[MeasureWeather]
RegExp=(?siU)<day d="2" t="(.*)" dt="(.*)".*<hi>(.*)</hi>.*<low>(.*)</low>.*<sunr>(.*)</sunr>.*<suns>(.*)</suns>(?(?=.*<part p="d">).*<icon>(.*)</icon>.*<t>(.*)</t>.*<wind>.*<s>(.*)</s>.*<gust>(.*)</gust>.*<d>(.*)</d>.*<t>(.*)</t>.*<bt>(.*)</bt>.*<ppcp>(.*)</ppcp>.*<hmid>(.*)</hmid>)(?(?=.*<part p="n">).*<icon>(.*)</icon>.*<t>(.*)</t>.*<wind>.*<s>(.*)</s>.*<gust>(.*)</gust>.*<d>(.*)</d>.*<t>(.*)</t>.*<bt>(.*)</bt>.*<ppcp>(.*)</ppcp>.*<hmid>(.*)</hmid>.*)
Substitute="":"-1"
[MeasureForecastDay3]
Measure=Plugin
Plugin=WebParser
Url=[MeasureWeather]
RegExp=(?siU)<day d="3" t="(.*)" dt="(.*)".*<hi>(.*)</hi>.*<low>(.*)</low>.*<sunr>(.*)</sunr>.*<suns>(.*)</suns>(?(?=.*<part p="d">).*<icon>(.*)</icon>.*<t>(.*)</t>.*<wind>.*<s>(.*)</s>.*<gust>(.*)</gust>.*<d>(.*)</d>.*<t>(.*)</t>.*<bt>(.*)</bt>.*<ppcp>(.*)</ppcp>.*<hmid>(.*)</hmid>)(?(?=.*<part p="n">).*<icon>(.*)</icon>.*<t>(.*)</t>.*<wind>.*<s>(.*)</s>.*<gust>(.*)</gust>.*<d>(.*)</d>.*<t>(.*)</t>.*<bt>(.*)</bt>.*<ppcp>(.*)</ppcp>.*<hmid>(.*)</hmid>.*)
Substitute="":"-1"
3- one measure, for every single data you want to display, for example:
Code: Select all
[MeasureLocationName]
Measure=Plugin
Plugin=WebParser
Url=[MeasureBase]
StringIndex=8
Otherwise, if you want to use a measure for every single data, if you look at this:
Weather Skin Tutorial by jsmorley, you'll find all the steps.
fonpaolo
Moderator
Posts: 1387 Joined: April 11th, 2013, 8:08 pm
Location: Italy
Post
by fonpaolo » February 21st, 2017, 8:56 am
Another suggestion, to shorten your code, since there's already a lot of code to display everything, you can combine two meters in one, from your code:
Code: Select all
[MeterTemp]
Meter=String
MeasureName=MeasureCurrentTemp
X=50
Y=5
FontFace=Ariel
FontSize=10
FontColor=255,255,255,255
AntiAlias=1
StringAlign=Center
StringEffect=Shadow
FontEffectColor=0,0,0,255
Text=Current Temp: %1 °C
It's up to you if it's better or not and if use Center, Right or Left align.
FreeRaider
Posts: 826 Joined: November 20th, 2012, 11:58 pm
Post
by FreeRaider » February 21st, 2017, 9:43 am
the simplest solution is: change the Update from -1 to
Out of curiosity: why you use a lot of measures if the same result can be achieved with a parent measure and four "children" measures?
fonpaolo
Moderator
Posts: 1387 Joined: April 11th, 2013, 8:08 pm
Location: Italy
Post
by fonpaolo » February 21st, 2017, 9:59 am
FreeRaider wrote: the simplest solution is: change the Update from -1 to
Out of curiosity: why you use a lot of measures if the same result can be achieved with a parent measure and four "children" measures?
Thanks FreeRaider, I missed that!
As you also noted, it's better to use a single measure to download everything and then extract from that, all the needed informations.
Another suggestion that should be used when building and testing any skin getting data from a web source:
- first download the data as an .xml file, then point your webParser to use the file instead of hit the site too often.
FreeRaider
Posts: 826 Joined: November 20th, 2012, 11:58 pm
Post
by FreeRaider » February 21st, 2017, 10:04 am
fonpaolo wrote: Thanks FreeRaider, I missed that!
As you also noted, it's better to use a single measure to download everything and then extract from that, all the needed informations.
Another suggestion that should be used when building and testing any skin getting data from a web source:
- first download the data as an .xml file, then point your webParser to use the file instead of hit the site too often.
You can use
Debug option
CyberTheWorm
Posts: 860 Joined: August 22nd, 2016, 11:32 pm
Location: Surrey, B.C., Canada
Post
by CyberTheWorm » February 21st, 2017, 10:07 am
FreeRaider wrote: the simplest solution is: change the Update from -1 to
Out of curiosity: why you use a lot of measures if the same result can be achieved with a parent measure and four "children" measures?
When you are learning better not to add everything in 1 shot. Now I know what I did wrong, I can tweak the code to simplify the code.
CyberTheWorm
Posts: 860 Joined: August 22nd, 2016, 11:32 pm
Location: Surrey, B.C., Canada
Post
by CyberTheWorm » February 21st, 2017, 10:10 am
fonpaolo wrote: Thanks FreeRaider, I missed that!
As you also noted, it's better to use a single measure to download everything and then extract from that, all the needed informations.
Another suggestion that should be used when building and testing any skin getting data from a web source:
- first download the data as an .xml file, then point your webParser to use the file instead of hit the site too often.
Right good idea
fonpaolo
Moderator
Posts: 1387 Joined: April 11th, 2013, 8:08 pm
Location: Italy
Post
by fonpaolo » February 21st, 2017, 10:24 am
Maybe you're already aware, CyberTheWorm, to test, find and display all the data you want, you can use this tool:
RainRegExp
If you're building a RegExp from scratch, if you're finding a specific StringIndex or trying to add/modify something, it's the best help.
Edit: I add this after FreeRaider beat me.