It is currently April 18th, 2024, 3:29 pm

Question about the combination of WebParser, DynamicVariables, and the log (Oh MY!!?)

Get help with installing and using Rainmeter.
thohan
Posts: 7
Joined: April 17th, 2016, 7:38 am

Question about the combination of WebParser, DynamicVariables, and the log (Oh MY!!?)

Post by thohan »

Hi!

I am in the midst of creating another weather skin to help replace the one I had based on the Wunderground ( I have decided to give Darksky a try). One of the Webparser measures I am using requires DynamicVariables has the Debug=2 option so a file is written. The weird thing is that once every second a debug message is written to the log even though, as far as I can tell, the website is not accessed and the file is not written except when the UpdateRate kicks in. I have included example code below that replicates what I am talking about.

After reading the following post quoted below and tips linked to below and being unable to find an option to turn off the debug message I have these questions.
  • Is This expected behavior?
  • Is this a bug?
  • and most important to me, is there away to suppress these messages?

Any Help would be appreciated. Thanks.
jsmorley wrote: March 29th, 2019, 11:52 am
Using UpdateDivider on WebParser parent or child measures is generally not (and by generally, I really mean never) the way to go. All that is done on the update of a WebParser parent measure is that the UpdateRate counter is incremented by one. Leave UpdateDivider on all WebParser measure set to the default value of 1, and don't use !UpdateMeasure.

https://docs.rainmeter.net/tips/
https://docs.rainmeter.net/tips/webparser-updaterate/

Code: Select all


[Rainmeter]
Update=1000
AccurateText=1

[Metadata]
Name=MyWebParser
Author=Me
Information=
Version=
License=Creative Commons Attribution - Non - Commercial - Share Alike 3.0

[Variables]

[MeasureGoogle]
Measure=WebParser
Url="https://www.google.com"
RegExp=(?siU)^(.*)$
Debug=2
Debug2File=#@#google.Dat
UpdateRate=600
DynamicVariables=1

[MeterShape]
Meter=Shape
Shape=Rectangle 0,0,150,150,20 |Fill Color 200,200,200,200 

User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Question about the combination of WebParser, DynamicVariables, and the log (Oh MY!!?)

Post by jsmorley »

It was not the intent that Debug=2 be used this way. The intent of it was for a one-time capture of the site, to help you with designing and debugging the RegExp you want to use. It writes to the log more or less to remind you that this is turned on, because you presumably want to turn it off as soon as it has captured the site once.

This log notice is created in the "Reload()" function of the measure, which is normally only executed once when the skin is loaded or refreshed, but is executed on every measure update if DynamicVariables=1. That is why it is flooding the log for you.

To capture the site for the purpose you have in mind, I suggest an alternative method. I would NOT use Debug=2 for this...

Code: Select all

[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1

[Variables]

[MeasureSite]
Measure=WebParser
URL=http://www.rainmeter.net
RegExp=(?siU)<title>(.*)</title>

[MeasureSaveSite]
Measure=WebParser
URL=http://www.rainmeter.net
Download=1
DownloadFile=EntireSite.txt

[MeasureTitle]
Measure=WebParser
URL=[MeasureSite]
StringIndex=1

[MeterTitle]
Meter=String
MeasureName=MeasureTitle
FontSize=11
FontWeight=400
FontColor=255,255,255,255
SolidColor=47,47,47,255
Padding=5,5,5,5
AntiAlias=1
https://docs.rainmeter.net/manual/measures/webparser/#DownloadFile

This does restrict you just a bit on where the file is created, as the DownloadFile option is always under the skin folder, in a sub-folder under that called DownloadFile.
thohan
Posts: 7
Joined: April 17th, 2016, 7:38 am

Re: Question about the combination of WebParser, DynamicVariables, and the log (Oh MY!!?)

Post by thohan »

I had not considered this as a possibility because I did not know that I could use the download\downloadFile option to download the entire page.

Thank you!
Last edited by thohan on April 3rd, 2019, 11:55 pm, edited 1 time in total.
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Question about the combination of WebParser, DynamicVariables, and the log (Oh MY!!?)

Post by jsmorley »

Or perhaps a better alternative, that only remotely accesses the site once instead of twice...

Code: Select all

[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1

[Variables]

[MeasureSaveSite]
Measure=WebParser
URL=http://www.rainmeter.net
Download=1
DownloadFile=EntireSite.txt
FinishAction=[!EnableMeasure MeasureSiteContents][!CommandMeasure MeasureSiteContents "Update"]

[MeasureSiteContents]
Measure=WebParser
URL=file://#CURRENTPATH#DownloadFile\EntireSite.txt
RegExp=(?siU)<title>(.*)</title>
Disabled=1

[MeasureTitle]
Measure=WebParser
URL=[MeasureSiteContents]
StringIndex=1

[MeterTitle]
Meter=String
MeasureName=MeasureTitle
FontSize=11
FontWeight=400
FontColor=255,255,255,255
SolidColor=47,47,47,255
Padding=5,5,5,5
AntiAlias=1
thohan
Posts: 7
Joined: April 17th, 2016, 7:38 am

Re: Question about the combination of WebParser, DynamicVariables, and the log (Oh MY!!?)

Post by thohan »

That is essentially what I was attempting to do. I have one skin (a clock skin that is up all the time) downloading the information and saves it to a file then a larger skin accesses that file to display all the information. Thia way I can keep up to date but tightly control how often the sites are accessed.

Again thank you.
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Question about the combination of WebParser, DynamicVariables, and the log (Oh MY!!?)

Post by jsmorley »

thohan wrote: April 3rd, 2019, 11:54 pm I had not considered this as a possibility because I did not know that I could use the download\downloadFile option to download the entire page.

Thank you!
Sure. The general intent of Download / DownloadFile is for doing things like downloading an image that is referenced in the HTML of a page, but if the target URL is just the entire site, that is what is downloaded. The net effect in this case is the same as Debug=2, but without any log notifications.