It is currently August 8th, 2020, 6:21 am

Weather Skins Not Working

Help with creating, editing & fixing problems with skins
DougS2K
Posts: 13
Joined: July 26th, 2020, 6:33 pm

Re: Weather Skins Not Working

Post by DougS2K »

So I've converted my skin to use your inc files jsmorley (Thanks for the work and effort BTW). Just one question if you don't mind. How do I get the following output in the picture to show either Today or Tonight depending on time of day instead of just the current day which is Saturday in this example? This was done through RegExp with the old coding but not sure how to adapt this to your coding. :confused:

Here is the code I'm currently using for the output:

Code: Select all

[MeterFWDay1]
Meter=String
MeterStyle=StyleFont1
StringAlign=center
Group=DAY1
MeasureName=@ForecastTodayDayLong
X=(#WEATHER5DAYAlignX#)
Y=(#WEATHER5DAYAlignY#)-2
ToolTipText=[@ForecastTodayDayLong]
DynamicVariables=1
Picture of what the output looks like now with what I'm talking about circled in green. Would like it to show "Today" or "Tonight" depending on time of day. https://imgur.com/362u8WS
User avatar
jsmorley
Developer
Posts: 21217
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Weather Skins Not Working

Post by jsmorley »

DougS2K wrote:
August 1st, 2020, 7:58 pm
So I've converted my skin to use your inc files jsmorley (Thanks for the work and effort BTW). Just one question if you don't mind. How do I get the following output in the picture to show either Today or Tonight depending on time of day instead of just the current day which is Saturday in this example? This was done through RegExp with the old coding but not sure how to adapt this to your coding. :confused:

Here is the code I'm currently using for the output:

Code: Select all

[MeterFWDay1]
Meter=String
MeterStyle=StyleFont1
StringAlign=center
Group=DAY1
MeasureName=@ForecastTodayDayLong
X=(#WEATHER5DAYAlignX#)
Y=(#WEATHER5DAYAlignY#)-2
ToolTipText=[@ForecastTodayDayLong]
DynamicVariables=1
Picture of what the output looks like now with what I'm talking about circled in green. Would like it to show "Today" or "Tonight" depending on time of day. https://imgur.com/362u8WS
What I do looks like this in my skin:

Code: Select all

[MeasureToggleAtNight]
Measure=String
Group=Weather
String=[@ForecastTodayDayTemperature]
DynamicVariables=1
IfMatch=^$
IfMatchAction=[!SetOption MeterTodayIcon MeasureName "@ForecastTodayNightIcon"][!SetOption MeterTodayName MeasureName "@ForecastTodayNightPart"][!SetOption MeterTodayHighLow MeasureName "@CurrentTemperatureMaxSince7AM"][!SetOption MeterTodayPrecipitation MeasureName "@ForecastTodayNightPrecipitationPercent"][!SetOption MeterTodayHighLow InlineSetting "Color | 160,160,160,255"]
IfNotMatchAction=[!SetOption MeterTodayIcon MeasureName "@ForecastTodayDayIcon"][!SetOption MeterTodayName MeasureName "@ForecastTodayDayPart"][!SetOption MeterTodayHighLow MeasureName "@ForecastTodayDayTemperature"][!SetOption MeterTodayPrecipitation MeasureName "@ForecastTodayDayPrecipitationPercent"][!SetOption MeterTodayHighLow InlineSetting "None"]
So I look to see if it is "day" or "night", but seeing if there is no forecasted "day" temperature, which there won't be after 3pm or so.
Then if that value is an empty string, I set various meters to use "night" measures instead of "day" measures.

[@ForecastTodayDayPart] and [@ForecastTodayNightPart] are the measures that will return "Today" and "Tonight".



1.jpg
You do not have the required permissions to view the files attached to this post.
DougS2K
Posts: 13
Joined: July 26th, 2020, 6:33 pm

Re: Weather Skins Not Working

Post by DougS2K »

jsmorley wrote:
August 1st, 2020, 8:16 pm
What I do looks like this in my skin:

Code: Select all

[MeasureToggleAtNight]
Measure=String
Group=Weather
String=[@ForecastTodayDayTemperature]
DynamicVariables=1
IfMatch=^$
IfMatchAction=[!SetOption MeterTodayIcon MeasureName "@ForecastTodayNightIcon"][!SetOption MeterTodayName MeasureName "@ForecastTodayNightPart"][!SetOption MeterTodayHighLow MeasureName "@CurrentTemperatureMaxSince7AM"][!SetOption MeterTodayPrecipitation MeasureName "@ForecastTodayNightPrecipitationPercent"][!SetOption MeterTodayHighLow InlineSetting "Color | 160,160,160,255"]
IfNotMatchAction=[!SetOption MeterTodayIcon MeasureName "@ForecastTodayDayIcon"][!SetOption MeterTodayName MeasureName "@ForecastTodayDayPart"][!SetOption MeterTodayHighLow MeasureName "@ForecastTodayDayTemperature"][!SetOption MeterTodayPrecipitation MeasureName "@ForecastTodayDayPrecipitationPercent"][!SetOption MeterTodayHighLow InlineSetting "None"]
So I look to see if it is "day" or "night", but seeing if there is no forecasted "day" temperature, which there won't be after 3pm or so.
Then if that value is an empty string, I set various meters to use "night" measures instead of "day" measures.

[@ForecastTodayDayPart] and [@ForecastTodayNightPart] are the measures that will return "Today" and "Tonight".




1.jpg
Thanks a bunch. That did the trick once I edited it a bit to match my labels. :thumbup:
pbutler6
Posts: 6
Joined: April 27th, 2020, 8:10 pm

Re: Weather Skins Not Working

Post by pbutler6 »

I am having a problem with the new WeatherConJSONAlerts.inc file. I get a RegExp matching error (-1) for [@AlertsParent] every 10 minutes (UpdateRate=1000).

There is no string in the Skins log for @AlertsParent. To try to isolate the problem I added a new [@EntireSiteSuperParent1] to your WeatehrConJSONAlerts.inc file, but I still get the error:

Code: Select all

[@EntireSiteSuperParent1]
Measure=WebParser
URL=#URLSite#
UpdateRate=#UpdateRate#
Flags=Resync | NoCookies
UserAgent=Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Firefox/78.0
DecodeCharacterReference=1
LogSubstringErrors=0
RegExp=(?siU)^(.*)$
StringIndex=1
FinishAction=[!EnableMeasureGroup Parents1]

[@AlertsParent]
Measure=WebParser
Group=Parents1
URL=[@EntireSiteSuperParent1]
Disabled=1
LogSubstringErrors=0
StringIndex=1
RegExp=#WeatherAlert#
User avatar
Yincognito
Posts: 2195
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Weather Skins Not Working

Post by Yincognito »

pbutler6 wrote:
August 1st, 2020, 9:07 pm
I am having a problem with the new WeatherConJSONAlerts.inc file. I get a RegExp matching error (-1) for [@AlertsParent] every 10 minutes (UpdateRate=1000).

There is no string in the Skins log for @AlertsParent. To try to isolate the problem I added a new [@EntireSiteSuperParent1] to your WeatehrConJSONAlerts.inc file, but I still get the error:

Code: Select all

[@EntireSiteSuperParent1]
Measure=WebParser
URL=#URLSite#
UpdateRate=#UpdateRate#
Flags=Resync | NoCookies
UserAgent=Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Firefox/78.0
DecodeCharacterReference=1
LogSubstringErrors=0
RegExp=(?siU)^(.*)$
StringIndex=1
FinishAction=[!EnableMeasureGroup Parents1]

[@AlertsParent]
Measure=WebParser
Group=Parents1
URL=[@EntireSiteSuperParent1]
Disabled=1
LogSubstringErrors=0
StringIndex=1
RegExp=#WeatherAlert#
I believe this issue has been already talked about briefly in another thread - I guess jsmorley will take care of it later on...
User avatar
jsmorley
Developer
Posts: 21217
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Weather Skins Not Working

Post by jsmorley »

pbutler6 wrote:
August 1st, 2020, 9:07 pm
I am having a problem with the new WeatherConJSONAlerts.inc file. I get a RegExp matching error (-1) for [@AlertsParent] every 10 minutes (UpdateRate=1000).

There is no string in the Skins log for @AlertsParent. To try to isolate the problem I added a new [@EntireSiteSuperParent1] to your WeatehrConJSONAlerts.inc file, but I still get the error:

Code: Select all

[@EntireSiteSuperParent1]
Measure=WebParser
URL=#URLSite#
UpdateRate=#UpdateRate#
Flags=Resync | NoCookies
UserAgent=Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Firefox/78.0
DecodeCharacterReference=1
LogSubstringErrors=0
RegExp=(?siU)^(.*)$
StringIndex=1
FinishAction=[!EnableMeasureGroup Parents1]

[@AlertsParent]
Measure=WebParser
Group=Parents1
URL=[@EntireSiteSuperParent1]
Disabled=1
LogSubstringErrors=0
StringIndex=1
RegExp=#WeatherAlert#
Simply replace the contents of WeatherComJSONAlerts.inc with this:

Code: Select all

; =================================================================================================
; WeatherComJSONAlerts.inc by JSMorley
; "Weather.com - Parsing the JSON" (https://forum.rainmeter.net/viewtopic.php?f=118&t=34628)
;
; Requires that WeatherComJSONVariables.inc and WeatherComJSONMeasures.inc
; be @Included in the skin before this file.
;
; Updated July 31, 2020
; ==================================================================================================

[@AlertsParent]
Measure=WebParser
Group=Parents
URL=[@EntireSiteSuperParent]
Disabled=1
LogSubstringErrors=0
StringIndex=1
RegExp=(?siU)"v3alertsHeadlines":(?(?=.*{.*,"alerts":).*{.*,"alerts":.*(?(?=.*{"detailKey").*:".*",.*,"eventDescription":"(.*)","severityCode":(.*),"severity":"(.*)",.*,"headlineText":"(.*)",.*}).*(?(?=.*{"detailKey").*:".*",.*,"eventDescription":"(.*)","severityCode":(.*),"severity":"(.*)",.*,"headlineText":"(.*)",.*}).*(?(?=.*{"detailKey").*:".*",.*,"eventDescription":"(.*)","severityCode":(.*),"severity":"(.*)",.*,"headlineText":"(.*)",.*}).*(?(?=.*{"detailKey").*:".*",.*,"eventDescription":"(.*)","severityCode":(.*),"severity":"(.*)",.*,"headlineText":"(.*)",.*}).*(?(?=.*{"detailKey").*:".*",.*,"eventDescription":"(.*)","severityCode":(.*),"severity":"(.*)",.*,"headlineText":"(.*)",.*}).*(?(?=.*{"detailKey").*:".*",.*,"eventDescription":"(.*)","severityCode":(.*),"severity":"(.*)",.*,"headlineText":"(.*)",.*}).*(?(?=.*{"detailKey").*:".*",.*,"eventDescription":"(.*)","severityCode":(.*),"severity":"(.*)",.*,"headlineText":"(.*)",.*}).*(?(?=.*{"detailKey").*:".*",.*,"eventDescription":"(.*)","severityCode":(.*),"severity":"(.*)",.*,"headlineText":"(.*)",.*}).*)

[@Alert1Description]
Measure=WebParser
Url=[@AlertsParent]
StringIndex=1
DecodeCharacterReference=1
RegExpSubstitute=1
Substitute=#CommonSubstitute#
DynamicVariables=1

[@Alert1SeverityCode]
Measure=WebParser
Url=[@AlertsParent]
StringIndex=2
Substitute=#CommonSubstitute#

[@Alert1Severity]
Measure=WebParser
Url=[@AlertsParent]
StringIndex=3
Substitute=#CommonSubstitute#

[@Alert1Text]
Measure=WebParser
Url=[@AlertsParent]
DecodeCharacterReference=1
StringIndex=4
Substitute=#CommonSubstitute#

[@Alert2Description]
Measure=WebParser
Url=[@AlertsParent]
StringIndex=5
DecodeCharacterReference=1
RegExpSubstitute=1
Substitute=#CommonSubstitute#
DynamicVariables=1

[@Alert2SeverityCode]
Measure=WebParser
Url=[@AlertsParent]
StringIndex=6
Substitute=#CommonSubstitute#

[@Alert2Severity]
Measure=WebParser
Url=[@AlertsParent]
StringIndex=7
Substitute=#CommonSubstitute#

[@Alert2Text]
Measure=WebParser
Url=[@AlertsParent]
StringIndex=8
DecodeCharacterReference=1
Substitute=#CommonSubstitute#

[@Alert3Description]
Measure=WebParser
Url=[@AlertsParent]
StringIndex=9
DecodeCharacterReference=1
RegExpSubstitute=1
Substitute=#CommonSubstitute#
DynamicVariables=1

[@Alert3SeverityCode]
Measure=WebParser
Url=[@AlertsParent]
StringIndex=10
Substitute=#CommonSubstitute#

[@Alert3Severity]
Measure=WebParser
Url=[@AlertsParent]
StringIndex=11
Substitute=#CommonSubstitute#

[@Alert3Text]
Measure=WebParser
Url=[@AlertsParent]
StringIndex=12
DecodeCharacterReference=1
Substitute=#CommonSubstitute#

[@Alert4Description]
Measure=WebParser
Url=[@AlertsParent]
StringIndex=13
DecodeCharacterReference=1
RegExpSubstitute=1
Substitute=#CommonSubstitute#
DynamicVariables=1

[@Alert4SeverityCode]
Measure=WebParser
Url=[@AlertsParent]
StringIndex=14
Substitute=#CommonSubstitute#

[@Alert4Severity]
Measure=WebParser
Url=[@AlertsParent]
StringIndex=15
Substitute=#CommonSubstitute#

[@Alert4Text]
Measure=WebParser
Url=[@AlertsParent]
StringIndex=16
DecodeCharacterReference=1
Substitute=#CommonSubstitute#

[@Alert5Description]
Measure=WebParser
Url=[@AlertsParent]
StringIndex=17
DecodeCharacterReference=1
RegExpSubstitute=1
Substitute=#CommonSubstitute#
DynamicVariables=1

[@Alert5SeverityCode]
Measure=WebParser
Url=[@AlertsParent]
StringIndex=18
Substitute=#CommonSubstitute#

[@Alert5Severity]
Measure=WebParser
Url=[@AlertsParent]
StringIndex=19
Substitute=#CommonSubstitute#

[@Alert5Text]
Measure=WebParser
Url=[@AlertsParent]
StringIndex=20
DecodeCharacterReference=1
Substitute=#CommonSubstitute#

[@Alert6Description]
Measure=WebParser
Url=[@AlertsParent]
StringIndex=21
DecodeCharacterReference=1
RegExpSubstitute=1
Substitute=#CommonSubstitute#
DynamicVariables=1

[@Alert6SeverityCode]
Measure=WebParser
Url=[@AlertsParent]
StringIndex=22
Substitute=#CommonSubstitute#

[@Alert6Severity]
Measure=WebParser
Url=[@AlertsParent]
StringIndex=23
Substitute=#CommonSubstitute#

[@Alert6Text]
Measure=WebParser
Url=[@AlertsParent]
StringIndex=24
DecodeCharacterReference=1
Substitute=#CommonSubstitute#

[@Alert7Description]
Measure=WebParser
Url=[@AlertsParent]
StringIndex=25
DecodeCharacterReference=1
RegExpSubstitute=1
Substitute=#CommonSubstitute#
DynamicVariables=1

[@Alert7SeverityCode]
Measure=WebParser
Url=[@AlertsParent]
StringIndex=26
Substitute=#CommonSubstitute#

[@Alert7Severity]
Measure=WebParser
Url=[@AlertsParent]
StringIndex=27
Substitute=#CommonSubstitute#

[@Alert7Text]
Measure=WebParser
Url=[@AlertsParent]
StringIndex=28
DecodeCharacterReference=1
Substitute=#CommonSubstitute#

[@Alert8Description]
Measure=WebParser
Url=[@AlertsParent]
StringIndex=29
DecodeCharacterReference=1
RegExpSubstitute=1
Substitute=#CommonSubstitute#
DynamicVariables=1

[@Alert8SeverityCode]
Measure=WebParser
Url=[@AlertsParent]
StringIndex=30
Substitute=#CommonSubstitute#

[@Alert8Severity]
Measure=WebParser
Url=[@AlertsParent]
StringIndex=31
Substitute=#CommonSubstitute#

[@Alert8Text]
Measure=WebParser
Url=[@AlertsParent]
StringIndex=32
DecodeCharacterReference=1
Substitute=#CommonSubstitute#
This will be corrected in the file the next time I distribute new .inc files.
buckb
Posts: 38
Joined: February 12th, 2018, 12:47 am

Re: Weather Skins Not Working - This is the only allowed thread about this

Post by buckb »

jsmorley wrote:
July 31st, 2020, 12:46 pm
We will be doing a beta of Rainmeter, probably a bit later today, that addresses this in WebParser, with a new "DecodeCodePoints" option for child measures, which will automatically decode Unicode references like \u0034 and such.
I don't know if you are still planning to add "DecodeCodePoints" now that you've decided to use the JSON API. However, if you do, perhaps the option should be a General measure option and not just a WebParser option? Much like Substitute and RegExpSubstitute manipulate a measure's string value, "DecodeCodePoints" would just be another type of string manipulation.
User avatar
jsmorley
Developer
Posts: 21217
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Weather Skins Not Working - This is the only allowed thread about this

Post by jsmorley »

buckb wrote:
August 1st, 2020, 11:09 pm
I don't know if you are still planning to add "DecodeCodePoints" now that you've decided to use the JSON API. However, if you do, perhaps the option should be a General measure option and not just a WebParser option? Much like Substitute and RegExpSubstitute manipulate a measure's string value, "DecodeCodePoints" would just be another type of string manipulation.
Hm... Where would you expect to see character references like that other than the result of WebParser? Much like DecodeCharacterReference, the only place I can see that happening is some external html/xml/json file. There is certainly no reason to put those codes in your skin yourself, as we have Character Variables designed for that.

I guess I can see an edge case for the Quote plugin, so let us chew on this just a bit.
User avatar
Yincognito
Posts: 2195
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Weather Skins Not Working - This is the only allowed thread about this

Post by Yincognito »

jsmorley wrote:
August 1st, 2020, 11:13 pm
Hm... Where would you expect to see character references like that other than the result of WebParser? Much like DecodeCharacterReference, the only place I can see that happening is some external html/xml/json file. There is certainly no reason to put those codes in your skin yourself, as we have Character Variables designed for that.

I guess I can see an edge case for the Quote plugin, so let us chew on this just a bit.
Yeah, anywhere you put it, as long as it works, personally I do want it. As I said, it's not just weather.com which does have these "code points", but other sites as well. Apart from that, while the API JSON is indeed the most convenient solution, I wouldn't like to be restricted (again) to just one single way of getting the data. Having at least two alternatives (the API JSON and the main site's one) is safer, in my view. Look how useful the API JSON alternative proved to be now.

Or, if you changed you mind, let me know so I can deal with the substitutions myself. :D
buckb
Posts: 38
Joined: February 12th, 2018, 12:47 am

Re: Weather Skins Not Working - This is the only allowed thread about this

Post by buckb »

jsmorley wrote:
August 1st, 2020, 11:13 pm
Hm... Where would you expect to see character references like that other than the result of WebParser? Much like DecodeCharacterReference, the only place I can see that happening is some external html/xml/json file. There is certainly no reason to put those codes in your skin yourself, as we have Character Variables designed for that.

I guess I can see an edge case for the Quote plugin, so let us chew on this just a bit.
I'm not sure I see the utility outside of the html/xml/json file use case either, but I'm often amazed by the ways skin developers use features. I just saw a certain congruity with the way Substitute works and so offered the observation.