It is currently July 13th, 2024, 4:08 pm

Weather Skins Not Working

Get help with creating, editing & fixing problems with skins
User avatar
Yincognito
Rainmeter Sage
Posts: 7719
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Weather Skins Not Working

Post by Yincognito »

jsmorley wrote: July 29th, 2020, 6:12 pm I agree, and that occurred to me first thing, but it really can't work that way. Substitute does not "change" the value of a measure, but only the string value that is obtained when some other measure "asks for" the string value of the measure. Child measures are not using the string value of the parent measure, and in fact don't "ask for" any value at all. The child measures values are automatically populated by WebParser itself as a part of the plugin functionality.

The other issue is that the entire weather.com site is ginormous, and using RegExpSubstitute on the entire value pretty much brings Rainmeter to its knees...
Yep, agreed on the first paragraph, it's the way WebParser and Substitute work - that's why I mentioned it's a "hypothetical" situation. I have doubts regarding second paragraph though, because as you might remember, I do a TON of such substitutions in my Feeds skin, for similar strings in length (or even longer) and the delay in parsing that is similar with the delay in parsing weather.com.

Anyway, I fixed the thing in my skin as well. I created a variable Q=\\" and just used it (i.e. #Q#) instead of the hardcoded quotes in my other variables that are involved in regexp substitutions, in case they revert the change tomorrow or something. Added ,"\\"":""" to my own "common substitute" variable and that was it. Had to slightly modify my "data" pattern, but the changes were minor.

Apperently we got away easy this time... 8-)
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
JamX
Posts: 207
Joined: October 4th, 2019, 2:46 pm

Re: Weather Skins Not Working

Post by JamX »

Yes, It's working again thanks to all of you
Capture.JPG
Yincognito:
Good, clever, solution with the variable declaration Q=\\"
You indeed never know what the site designers will do in the future.
You do not have the required permissions to view the files attached to this post.
User avatar
Yincognito
Rainmeter Sage
Posts: 7719
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Weather Skins Not Working

Post by Yincognito »

jsmorley wrote: July 29th, 2020, 5:32 pm Yeah, that does seem to work, but crap, that's a lot of changes.
Some other undesirable changes that I noticed. There are now more characters encoded as \uNumber, for example \u0219 aka ș (and probably others), so that might pose a problem for using a weather skin in some local languages, as DecodeCharacterReference doesn't cover the \uNumber cases, as far as I know. One cannot use a substitution like "\\u([0-9A-F]+)":"[\x\1]" either, because of that substitution / variable / character reference order I once talked about here with you and probably Brian as well.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
SilverAzide
Rainmeter Sage
Posts: 2683
Joined: March 23rd, 2015, 5:26 pm

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

Post by SilverAzide »

^ Dang it. Yeah, the weather in Russian is completely hosed.
Gadgets Wiki GitHub More Gadgets...
User avatar
balala
Rainmeter Sage
Posts: 16389
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Weather Skins Not Working

Post by balala »

jsmorley wrote: July 29th, 2020, 6:05 pm So it seems like two steps are needed.

1) Replace all " with \\" in all RegExp options in the various WeatherComJSONMeasures*.inc files.
2) Add ,"\\":"" to the end of #CommonSubstitute# in the WeatherComJSONVariables.inc file.

And bingo...

1.jpg
Right, it indeed does work now. But a new problem arises and can't figure out a solution. Maybe someone can.
The problem is when using other language than English, which has characters with diacritics. For instance if I replace the Language variable within the WeatherComJSONVariables.inc file with Language=hu-HU (Hungarian), this is what I get:
HU.png
As you can see, the description is not ok. The "framed" character should be an é, but it appears as u00E9.
Same for Romanian: with the Language=ro-RO variable, I get this:
RO.png
This time the framed character should be a ț instead of u0163.
I tried to fix this by adding a DecodeCharacterReference=1 option to the appropriate WebParser measures into the WeatherComJSONMeasures3Day.inc file. Didn't help. Finally I ended up by adding the DecodeCharacterReference=1 option to all WebParser measures of the WeatherComJSONMeasures3Day.inc file, but didn't help either.
So, is the only solution a substitution?
Thanks for any idea.
You do not have the required permissions to view the files attached to this post.
User avatar
jsmorley
Developer
Posts: 22646
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Weather Skins Not Working

Post by jsmorley »

balala wrote: July 29th, 2020, 7:57 pm Right, it indeed does work now. But a new problem arises and can't figure out a solution. Maybe someone can.
The problem is when using other language than English, which has characters with diacritics. For instance if I replace the Language variable within the WeatherComJSONVariables.inc file with Language=hu-HU (Hungarian), this is what I get:
HU.png
As you can see, the description is not ok. The "framed" character should be an é, but it appears as u00E9.
Same for Romanian: with the Language=ro-RO variable, I get this:
RO.png
This time the framed character should be a ț instead of u0163.
I tried to fix this by adding a DecodeCharacterReference=1 option to the appropriate WebParser measures into the WeatherComJSONMeasures3Day.inc file. Didn't help. Finally I ended up by adding the DecodeCharacterReference=1 option to all WebParser measures of the WeatherComJSONMeasures3Day.inc file, but didn't help either.
So, is the only solution a substitution?
Thanks for any idea.
This is no doubt a result of my stripping off all the \ characters in #CommonSubstitute#. Let me chew on this just a bit.

Edit... No, it's not that specifically.
User avatar
Yincognito
Rainmeter Sage
Posts: 7719
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Weather Skins Not Working

Post by Yincognito »

jsmorley wrote: July 29th, 2020, 8:00 pm This is no doubt a result of my stripping off all the \ characters in #CommonSubstitute#. Let me chew on this just a bit.
I doubt it. It is present in the page source itself:

Code: Select all

[8,9,9,8,8,7,6,6,5,4,4,4,5,5,4,4,5,6,8,11,11,10,10,8,8,8,8,8,8,7,6,7,6,7,8,8,9,11,12,13,13,14,14,15,12,11,11,11],\"wxPhraseLong\":[\"Par\u0163ial \u00EEnnorat\",\"\u00CEn mare parte \u00EEnnorat\",\"\u00CEn mare parte \u00EEnnorat\",\"Par\u0163ial \u00EEnnorat\",\"Par\u0163ial \u00EEnnorat\",\"Par\u0163ial \u00EEnnorat\",\"Par\u0163ial \u00EEnnorat\",\"\u00CEn mare parte senin\",\"\u00CEn mare parte senin\",\"\u00CEn mare parte senin\",\"Par\u0163ial \u00EEnnorat\",\"Par\u0163ial \u00EEnnorat\",\"Par\u0163ial \u00EEnnorat\",\"Par\u0163ial \u00EEnnorat\",\"Par\u0163ial \u00EEnnorat\",\"Furtuni cu fulgere izolate\",\"Furtuni cu fulgere izolate\",\"Furtuni cu fulgere izolate\",\"Furtuni cu fulgere izolate\",\"Furtuni cu fulgere izolate\",\"Furtuni cu fulgere izolate\",\"Furtuni cu fulgere izolate\",\"Furtuni cu fulgere izolate\",\"Par\u0163ial \u00EEnnorat\",\"Par\u0163ial \u00EEnnorat\",\"Par\u0163ial \u00EEnnorat\",\"Par\u0163ial \u00EEnnorat\",\"Par\u0163ial \u00EEnnorat\",\"Par\u0163ial \u00EEnnorat\",\"Par\u0163ial \u00EEnnorat\",\"\u00CEn mare parte senin\",\"\u00CEn mare parte senin\",\"Par\u0163ial \u00EEnnorat\",\"\u00CEn mare parte senin\",\"Par\u0163ial \u00EEnnorat\",\"Par\u0163ial \u00EEnnorat\",\"Par\u0163ial \u00EEnnorat\",\"Par\u0163ial \u00EEnnorat\",\"\u00CEn mare parte \u00EEnnorat\",\"Averse\",\"\u00CEn mare parte \u00EEnnorat\",\"\u00CEn mare parte \u00EEnnorat\",\"\u00CEnnorat\",\"\u00CEnnorat\",\"\u00CEn mare parte \u00EEnnorat\",\"Par\u0163ial \u00EEnnorat\",\"Par\u0163ial \u00EEnnorat\",\"Par\u0163ial \u00EEnnorat\"]
Notice the \uHexNumber occurences.

P.S. Yet again, when I switch to the "API mode" in my skin, there are no issues and the characters are displayed properly, so it's probably a result of the escaping thing on the main site. In other words, more than just quotes are escaped, one way or another.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
jsmorley
Developer
Posts: 22646
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Weather Skins Not Working

Post by jsmorley »

Yincognito wrote: July 29th, 2020, 8:01 pm I doubt it. It is present in the page source itself:

Code: Select all

[8,9,9,8,8,7,6,6,5,4,4,4,5,5,4,4,5,6,8,11,11,10,10,8,8,8,8,8,8,7,6,7,6,7,8,8,9,11,12,13,13,14,14,15,12,11,11,11],\"wxPhraseLong\":[\"Par\u0163ial \u00EEnnorat\",\"\u00CEn mare parte \u00EEnnorat\",\"\u00CEn mare parte \u00EEnnorat\",\"Par\u0163ial \u00EEnnorat\",\"Par\u0163ial \u00EEnnorat\",\"Par\u0163ial \u00EEnnorat\",\"Par\u0163ial \u00EEnnorat\",\"\u00CEn mare parte senin\",\"\u00CEn mare parte senin\",\"\u00CEn mare parte senin\",\"Par\u0163ial \u00EEnnorat\",\"Par\u0163ial \u00EEnnorat\",\"Par\u0163ial \u00EEnnorat\",\"Par\u0163ial \u00EEnnorat\",\"Par\u0163ial \u00EEnnorat\",\"Furtuni cu fulgere izolate\",\"Furtuni cu fulgere izolate\",\"Furtuni cu fulgere izolate\",\"Furtuni cu fulgere izolate\",\"Furtuni cu fulgere izolate\",\"Furtuni cu fulgere izolate\",\"Furtuni cu fulgere izolate\",\"Furtuni cu fulgere izolate\",\"Par\u0163ial \u00EEnnorat\",\"Par\u0163ial \u00EEnnorat\",\"Par\u0163ial \u00EEnnorat\",\"Par\u0163ial \u00EEnnorat\",\"Par\u0163ial \u00EEnnorat\",\"Par\u0163ial \u00EEnnorat\",\"Par\u0163ial \u00EEnnorat\",\"\u00CEn mare parte senin\",\"\u00CEn mare parte senin\",\"Par\u0163ial \u00EEnnorat\",\"\u00CEn mare parte senin\",\"Par\u0163ial \u00EEnnorat\",\"Par\u0163ial \u00EEnnorat\",\"Par\u0163ial \u00EEnnorat\",\"Par\u0163ial \u00EEnnorat\",\"\u00CEn mare parte \u00EEnnorat\",\"Averse\",\"\u00CEn mare parte \u00EEnnorat\",\"\u00CEn mare parte \u00EEnnorat\",\"\u00CEnnorat\",\"\u00CEnnorat\",\"\u00CEn mare parte \u00EEnnorat\",\"Par\u0163ial \u00EEnnorat\",\"Par\u0163ial \u00EEnnorat\",\"Par\u0163ial \u00EEnnorat\"]
Notice the \uHexNumber occurences.
So they have replaced all literal characters that are outside of the range of ASCII with Unicode references?
User avatar
Yincognito
Rainmeter Sage
Posts: 7719
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Weather Skins Not Working

Post by Yincognito »

jsmorley wrote: July 29th, 2020, 8:12 pm So they have replaced all literal characters that are outside of the range of ASCII with Unicode references?
Seems like it, yeah. So far, I can only confirm the quotes (escaped with \) and the local characters in my language (escaped with \u), but as SilverAzide and balala confirmed, it is true for other languages like Russian, Hungarian, etc.

EDIT: This can, of course, be circumvented if only a substitution like "\\u([0-9A-F]+)":"[\x\1]" would work (or if DecodeCharacterReference would do the \uNumber decoding, on demand - I guess such an option could be added, although it might be some work involved), or if the entire string / superparent (doesn't have to be the entire site, though, just the JSON part) would be transferred into a String measure where it could be properly manipulated through (I believe, successive) substitutions, so that they won't interfere with the [\xNumber] character reference variable happening before the other variables parsing in Rainmeter...
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
jsmorley
Developer
Posts: 22646
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Weather Skins Not Working

Post by jsmorley »

Yincognito wrote: July 29th, 2020, 8:22 pm Seems like it, yeah. So far, I can only confirm the quotes (escaped with \) and the local characters in my language (escaped with \u), but as SilverAzide and balala confirmed, it is true for other languages like Russian, Hungarian, etc.

EDIT: This can, of course, be circumvented if only a substitution like "\\u([0-9A-F]+)":"[\x\1]" would work (or if DecodeCharacterReference would do the \uNumber decoding, on demand - I guess such an option could be added, although it might be some work involved), or if the entire string / superparent (doesn't have to be the entire site, though, just the JSON part) would be transferred into a String measure where it could be properly manipulated through (I believe, successive) substitutions, so that they won't interfere with the [\xNumber] character reference variable happening before the other variables parsing in Rainmeter...
I don't think we can depend on DecodeCharacterReference for this, as that is designed to decode HTML characters references like &#nnnn;, &#xhhhh;, or &name;. This is an unfortunate situation, as I think the only current alternative is some kind of massive lookup / substitution on all these possible characters, which a bunch.

It might be that the API / JSON approach might be the way forward.