It is currently September 21st, 2021, 5:53 pm

Weather Skins Not Working

Help with creating, editing & fixing problems with skins
User avatar
jsmorley
Developer
Posts: 22290
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, 5:24 pm Yeah, just wondering why I got mails about non existing posts, LOL. Good idea, to keep it centralized.
And yes, they are just escaping quotes. Switched on my API version in the meantime, and it all works well there, no escaped quotes, so I'm guessing the quote escaping is not yet consistent or stable, thus I'll be patient for the time being.
Yeah, this might be a short-term problem.
MattNY177
Posts: 23
Joined: December 3rd, 2018, 1:15 am

Re: Weather Skins Not Working

Post by MattNY177 »

jsmorley wrote: July 29th, 2020, 3:57 pmSeems so...
I was able to do a quick fix by simply find/replace all the double quotes in the RegExp to \\"

It doesn't work for every field but it's a good start for anyone looking for a band-aid solution.
User avatar
jsmorley
Developer
Posts: 22290
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Weather Skins Not Working

Post by jsmorley »

MattNY177 wrote: July 29th, 2020, 5:28 pm I was able to do a quick fix by simply find/replace all the double quotes in the RegExp to \\"

It doesn't work for every field but it's a good start for anyone looking for a band-aid solution.
Yeah, that does seem to work, but crap, that's a lot of changes.
User avatar
Yincognito
Rainmeter Sage
Posts: 4052
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.
Yeah, the thing is they are escaping the field names as well, not just the field values, which is why your substitutions might not work. Didn't look into this in detail - as in my view, unless they're trying to make all the JSON part a huge string (in JSON string values, quotes are indeed escaped), this quote escaping doesn't make much sense -, so it's just a wild guess.
User avatar
jsmorley
Developer
Posts: 22290
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, 5:45 pm Yeah, the thing is they are escaping the field names as well, not just the field values, which is why your substitutions might not work. Didn't look into this in detail - as in my view, unless they're trying to make all the JSON part a huge string (in JSON string values, quotes are indeed escaped), this quote escaping doesn't make much sense -, so it's just a wild guess.
Yeah, I'm tempted to wait 24 hours before I make the boatload of changes this would require.

I think just replacing " with \\" in all RegExp options should work in theory, since both the field names and string values were and are enclosed in quotes already.
User avatar
Yincognito
Rainmeter Sage
Posts: 4052
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Weather Skins Not Working

Post by Yincognito »

Yep, just figured out why this happens. The start of the <script> element in the HTML now looks like this:
<script>window.__data=JSON.parse(...
In other words, it looks like they are indeed trying to turn everything into a long string, hence the escaped quotes.

I guess the reason why the API version doesn't suffer from this drawback is because it is already a JSON file per se.
User avatar
Yincognito
Rainmeter Sage
Posts: 4052
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Weather Skins Not Working

Post by Yincognito »

jsmorley wrote: July 29th, 2020, 5:50 pmI think just replacing " with \\" in all RegExp options should work in theory, since both the field names and string values were and are enclosed in quotes already.
Hypothetically, this could have been solved in a heartbeat if only the Substitutions made in WebParser measures (i.e. the parents) would have been propagated to the children, through the StringIndexes. If that was the case (which is not, obviously), as simple replacement of \" with " in the superparent would have been enough, as every child or grandchild of it would have received the modified result.
Last edited by Yincognito on July 29th, 2020, 6:06 pm, edited 1 time in total.
User avatar
jsmorley
Developer
Posts: 22290
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Weather Skins Not Working

Post by jsmorley »

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
You do not have the required permissions to view the files attached to this post.
User avatar
jsmorley
Developer
Posts: 22290
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, 6:05 pm Hypothetically, this could have been solved in a heartbeat if only the Substitutions made in WebParser measures (i.e. the parents) would have been propagated to the children, through the StringIndexes. If that was the case (which is not, obviously), as simple replacement of \" with " in the superparent would have been enough, as every child or grandchild of it would have received the modified result.
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...
User avatar
pul53dr1v3r
Posts: 437
Joined: July 30th, 2014, 10:30 am

Re: Weather Skins Not Working

Post by pul53dr1v3r »

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.
It fixed the issue. Thanks Morley! :rosegift: