It is currently October 12th, 2024, 3:49 am

Weather Skins Not Working

Get help with creating, editing & fixing problems with skins
User avatar
Yincognito
Rainmeter Sage
Posts: 8421
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...
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
jsmorley
Developer
Posts: 22850
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: 67
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: 22850
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
Rainmeter Sage
Posts: 8421
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
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
buckb
Posts: 67
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.
User avatar
Brian
Developer
Posts: 2738
Joined: November 24th, 2011, 1:42 am
Location: Utah

Re: Weather Skins Not Working

Post by Brian »

For now, this is just an option for Webparser. It will decode unicode code points like \uXXXX and \UXXXXXXXX (although the former is used most often). This doesn't do octal code points.

I am not sure there is a huge need for this outside of Webparser. We already have character variables that work in the same way.

There may some need to have it work with features that can read other files like the quote plugin and lua, but we haven't made any decisions about that yet.

-Brian
User avatar
jsmorley
Developer
Posts: 22850
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 »

Yincognito wrote: August 1st, 2020, 11:43 pm 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
Done... The beta with this new option is out.
User avatar
Yincognito
Rainmeter Sage
Posts: 8421
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Weather Skins Not Working

Post by Yincognito »

Brian wrote: August 2nd, 2020, 12:11 am For now, this is just an option for Webparser. It will decode unicode code points like \uXXXX and \UXXXXXXXX (although the former is used most often). This doesn't do octal code points.

I am not sure there is a huge need for this outside of Webparser. We already have character variables that work in the same way.

There may some need to have it work with features that can read other files like the quote plugin and lua, but we haven't made any decisions about that yet.

-Brian
Looks good to me. Regarding the Quote plugin, I'm no expert in it, but isn't a part of the plugin functionality (i.e. reading random lines from a file) able to be replicated by using a Calc measure and a WebParser measure parsing a local file anyway? Assuming there are \uXXXX code points in that file, that is.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
jsmorley
Developer
Posts: 22850
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Weather Skins Not Working

Post by jsmorley »

Yincognito wrote: August 2nd, 2020, 12:43 am Looks good to me. Regarding the Quote plugin, I'm no expert in it, but isn't a part of the plugin functionality (i.e. reading random lines from a file) able to be replicated by using a Calc measure and a WebParser measure parsing a local file anyway? Assuming there are \uXXXX code points in that file, that is.
Note that this supports "normalization" of Unicode code points as well.

https://flaviocopes.com/unicode/#normalization

So the string \uD834\uDF06 would decode to 𝌆

P.S. This also works with Character Variables in Rainmeter.