It is currently April 18th, 2024, 11:10 pm

how can i trim the seconds of a WebParser countdown

Get help with creating, editing & fixing problems with skins
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: how can i trim the seconds of a WebParser countdown

Post by jsmorley »

Having a WebParser measure that goes out, downloads an entire site, and parses it for information once every 50 milliseconds is entirely the wrong way to go. Aside from the fact that this is going to use huge amounts of network bandwidth and CPU, it also almost certain to hang WebParser and require a restart of Rainmeter periodically. This can't possibly even begin to work. Mining BitCoin will use less resources.

What you want is a Time measure that tracks the seconds, when it is at zero, or the top of a minute, then have that use !CommandMeasure to update the WebParser measure. Have that get the time you are looking for, but change the RegExp so it excludes the seconds, you don't want or need them.

Since it might take a second or more to get the site and parse it, and it is not certain that your clock is sync'd to the second with theirs, I might be tempted to have it fire when the seconds are at 5 or 10 or 30 or something, so you don't end up a minute behind all the time. You can try it with zero, and see how it goes.

That way you are hitting the remote site once a minute, which is ok.

Then you can display the hours and minutes you get from the WebParser. I doubt you are going to get the seconds to be terribly accurate, so I would probably leave them off.

Note: The far more accurate, and satisfying, way to do this is to just parse the site once a day, and collect all the "times" that are posted for the various parts of the day. Then using your local time zone as an offset, figure out which is the "next" time that is coming up, and set a countdown timer to that from the current local time. That will give you the time accurate to the second, and won't require hammering the website with WebParser. The downside of this is that it is a bit complex to do, and may be a bit much for someone new to Rainmeter.
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: how can i trim the seconds of a WebParser countdown

Post by jsmorley »

There are several "prayer time" skins on deviantART that might be a better option, at least for seeing how they do it, and modifying the approach for your skin. Not sure you need to re-invent the wheel here...

https://www.deviantart.com/customization/skins/sysmonitor/rainmeter/newest/?q=prayer
https://www.deviantart.com/art/Salaati-10-Prayer-Times-for-Rainmeter-428011336