I wrote a custom plugin in pure C++ called JsonParser, which, surprise, parses JSON input. I'm accepting source and query; source should be JSON and query is in dot/array notation, such as:
member["member2"].member3[5].member4
I wrote a lot of unit tests, so I'm quite certain, that the plugin works correctly (moreover I tested it too in Rainmeter by passing raw JSON as source).
I'm trying to make my plugin work with WebParser and I'm having difficulties passing data from the latter to the former. Skin source looks more like following:
Code: Select all
[Rainmeter]
Update=1000
[Variables]
TextSize=24
TextForeground=0,0,0,255
BackgroundFrom=255,255,255,80
BackgroundTo=255,255,255,40
[TextStyle]
FontFace=Segoe UI Light
FontSize=#TextSize#
AntiAlias=1
[MeasureWeather]
Measure=WebParser
UpdateRate=60
URL=https://api.openweathermap.org/data/2.5/onecall?lat=51.10&lon=17.03&units=metric&appid=(API-KEY-HIDDEN)
RegExp=(?siU)^(.*)$
Debug=1
[MeasureWeather1]
Measure=WebParser
URL=[MeasureWeather]
StringIndex=1
[MeasureTemperature]
Measure=Plugin
Plugin=PluginJsonParser
Source=[MeasureWeather1]
Query=current.temp
[MeterBackground]
Meter=Shape
Shape=Rectangle 0,0,200,50,5,5 | Fill LinearGradient BackgroundGradient | Stroke Color 0,0,0,0
BackgroundGradient=90 | #BackgroundFrom# ; 0.0 | #BackgroundTo# ; 1.0
[MeterTemperature]
Meter=String
MeasureName=MeasureTemperature
MeterStyle=TextStyle
X=35
Y=3
FontColor=#TextForeground#
So the question: why Rainmeter is not passing measure contents to my plugin? Or should I do something special to evaluate final string in the plugin? The plugin itself gets data in the following way:
Code: Select all
void Measure::reload(void* rm, double* maxValue)
{
this->source = std::wstring(RmReadString(rm, L"Source", L"", FALSE));
this->query = std::wstring(RmReadString(rm, L"Query", L"", FALSE));
RmLog(rm, 0, this->source.c_str());
RmLog(rm, 0, this->query.c_str());
// Cache query result
result = parse(source, query);
// Try to convert result to double value
try
{
this->numeric = std::stod(result);
}
catch (std::exception&)
{
this->numeric = 0.0;
}
}
Code: Select all
[MeasureWeather1] (TestSkin\TestSkin.ini - [MeasureTemperature])
current.temp (TestSkin\TestSkin.ini - [MeasureTemperature])