mirror of
https://projects.vdr-developer.org/git/vdr-plugin-skindesigner.git
synced 2023-10-19 15:58:31 +00:00
introduced weather service interface
This commit is contained in:
@@ -539,6 +539,19 @@ void cDisplayChannelView::DrawCustomTokens(void) {
|
||||
DrawViewElement(veCustomTokens, &stringTokens, &intTokens);
|
||||
}
|
||||
|
||||
void cDisplayChannelView::DrawCurrentWeather(void) {
|
||||
if (!ViewElementImplemented(veCurrentWeather)) {
|
||||
return;
|
||||
}
|
||||
map < string, string > stringTokens;
|
||||
map < string, int > intTokens;
|
||||
SetCurrentWeatherTokens(stringTokens, intTokens);
|
||||
|
||||
ClearViewElement(veCurrentWeather);
|
||||
DrawViewElement(veCurrentWeather, &stringTokens, &intTokens);
|
||||
}
|
||||
|
||||
|
||||
void cDisplayChannelView::Action(void) {
|
||||
SetInitFinished();
|
||||
FadeIn();
|
||||
|
||||
@@ -51,6 +51,7 @@ public:
|
||||
void ClearChannelGroups(void);
|
||||
void DisplayMessage(eMessageType Type, const char *Text);
|
||||
void DrawCustomTokens(void);
|
||||
void DrawCurrentWeather(void);
|
||||
void DoStart(void) { Start(); };
|
||||
void Flush(void) { DoFlush(); };
|
||||
};
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include <vdr/menu.h>
|
||||
#include "../services/scraper2vdr.h"
|
||||
#include "../services/weatherforecast.h"
|
||||
#include "../config.h"
|
||||
#include "../libcore/helpers.h"
|
||||
#include "viewhelpers.h"
|
||||
@@ -425,3 +426,30 @@ bool cViewHelpers::SetDate(map < string, string > &stringTokens, map < string, i
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void cViewHelpers::SetCurrentWeatherTokens(map < string, string > &stringTokens, map < string, int > &intTokens) {
|
||||
static cPlugin *pWeatherForecast = cPluginManager::GetPlugin("weatherforecast");
|
||||
if (!pWeatherForecast)
|
||||
return;
|
||||
cServiceCurrentWeather currentWeather;
|
||||
if (!pWeatherForecast->Service("GetCurrentWeather", ¤tWeather)) {
|
||||
return;
|
||||
}
|
||||
esyslog("skindesigner: service call successfull");
|
||||
stringTokens.insert(pair<string,string>("timestamp", currentWeather.timeStamp));
|
||||
stringTokens.insert(pair<string,string>("temperature", currentWeather.temperature));
|
||||
stringTokens.insert(pair<string,string>("apparenttemperature", currentWeather.apparentTemperature));
|
||||
stringTokens.insert(pair<string,string>("summary", currentWeather.summary));
|
||||
stringTokens.insert(pair<string,string>("icon", currentWeather.icon));
|
||||
stringTokens.insert(pair<string,string>("precipitationintensity", currentWeather.precipitationIntensity));
|
||||
intTokens.insert(pair<string,int>("precipitationprobability", currentWeather.precipitationProbability));
|
||||
stringTokens.insert(pair<string,string>("precipitationtype", currentWeather.precipitationType));
|
||||
intTokens.insert(pair<string,int>("humidity", currentWeather.humidity));
|
||||
stringTokens.insert(pair<string,string>("windspeed", currentWeather.windSpeed));
|
||||
intTokens.insert(pair<string,int>("windbearing", currentWeather.windBearing));
|
||||
stringTokens.insert(pair<string,string>("windbearingstring", currentWeather.windBearingString));
|
||||
stringTokens.insert(pair<string,string>("visibility", currentWeather.visibility));
|
||||
intTokens.insert(pair<string,int>("cloudcover", currentWeather.cloudCover));
|
||||
stringTokens.insert(pair<string,string>("pressure", currentWeather.pressure));
|
||||
stringTokens.insert(pair<string,string>("ozone", currentWeather.ozone));
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@ protected:
|
||||
void SetScraperTokens(const cEvent *event, const cRecording *recording, map < string, string > &stringTokens, map < string, int > &intTokens, map < string, vector< map< string, string > > > &loopTokens);
|
||||
bool SetTime(map < string, string > &stringTokens, map < string, int > &intTokens);
|
||||
bool SetDate(map < string, string > &stringTokens, map < string, int > &intTokens);
|
||||
void SetCurrentWeatherTokens(map < string, string > &stringTokens, map < string, int > &intTokens);
|
||||
public:
|
||||
cViewHelpers(void);
|
||||
virtual ~cViewHelpers(void);
|
||||
|
||||
Reference in New Issue
Block a user