Rainmeter WebParser Problems

Filed under Uncategorized

A colleague recently pointed me to a fantastic little desktop customization app for windows, RainMeter.

He was using the lottaweather skin, so I pulled that as well, and I’ve found it quite nice to have a really clear forecast stuck right there on the desktop.

Beautiful Weather Skin

It’s tiny, quite capable, and is really easy to knock up a quick notification panel or whatnot based on a webservice, or so I thought.

At work, we’d recently been throwing ideas around about how to be reasonably notified of build failures and Pull Requests/Statuses.

Another colleague came across AnyStatus, which is quite nice in it’s own right, but I thought it’d be nice to have something in the same style as lottaweathers skin.

I’ll dig into the details of scraping azuredevops and jenkins later, but while putting things together, I ran into a vexing problem.

I had one measure that resolved the users azure guid “id” given their name and a different measure that requested all the Pull Requests where that userid was listed as a “reviewer”.

Pretty standard stuff for RainMeter, and the urls I was using worked just fine in PostMan, but not Rainmeter.

Actually, the UserID request worked, but not the Pull Request query.

Here’s the measure definitiion:

[MeasureMyReviews]
Measure=WebParser
Disabled=1
URL=https://azuredevops.blahblah.com/#organization#/#project#/_apis/git/repositories/#repository#/pullrequests?api-version=5.1&searchCriteria.reviewerId=[MeasureUserID]
Header=Authorization:Basic #AzureDevOpsPATBase64#

After WAY too much head scratching, I discovered the problem was two-fold.

  1. My measure referenced the UserID measure like so: [MeasureUserID] but that syntax doesn’t work in this context. In a URL definition, it needs to be [&MeasureUserID] (note the &)
  2. WebParser measures happen asynchronously, but in this case, the “MeasureMyReviews” has to happen AFTER the MeasureUserID. Otherwise, the userid hasn’t been resolved and will just be blank.

The fix was to set Disabled=1 for the MeasureMyReviews measure, then enable it in the FinishAction of MeasureUserID, like so:

[MeasureUserID]
Measure=WebParser
URL=https://azuredevops.blahblah.com/#organization#/_apis/identities?api-version=5.1&searchFilter=General&filterValue=#username#
Header=Authorization:Basic #AzureDevOpsPATBase64#
RegExp=(?siU)"id":"(.*)"
StringIndex=1
DynamicVariables=1
FinishAction=[!SetOption MeasureMyReviews Disabled 0][!UpdateMeasure MeasureMyReviews]

Note the two bang commands in the “FinishAction”

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*

*