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:
parent
c59cc4e610
commit
4d8d1cc629
@ -169,6 +169,7 @@ void cSDDisplayChannel::Flush(void) {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if (initial) {
|
if (initial) {
|
||||||
|
channelView->DrawCurrentWeather();
|
||||||
channelView->DrawCustomTokens();
|
channelView->DrawCustomTokens();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
<!ELEMENT displaychannel (background | channelinfo | epginfo | progressbar | progressbarback |
|
<!ELEMENT displaychannel (background | channelinfo | epginfo | progressbar | progressbarback |
|
||||||
statusinfo | audioinfo | screenresolution | channelgroup |
|
statusinfo | audioinfo | screenresolution | channelgroup |
|
||||||
signalquality | signalqualityback | devices | scrapercontent |
|
signalquality | signalqualityback | devices | currentweather | scrapercontent |
|
||||||
datetime | time | message | customtokens)* >
|
datetime | time | message | customtokens)* >
|
||||||
<!ATTLIST displaychannel
|
<!ATTLIST displaychannel
|
||||||
x CDATA #REQUIRED
|
x CDATA #REQUIRED
|
||||||
@ -78,6 +78,11 @@
|
|||||||
debug CDATA #IMPLIED
|
debug CDATA #IMPLIED
|
||||||
>
|
>
|
||||||
|
|
||||||
|
<!ELEMENT currentweather (area|areascroll)*>
|
||||||
|
<!ATTLIST currentweather
|
||||||
|
debug CDATA #IMPLIED
|
||||||
|
>
|
||||||
|
|
||||||
<!ELEMENT scrapercontent (area|areascroll)*>
|
<!ELEMENT scrapercontent (area|areascroll)*>
|
||||||
<!ATTLIST scrapercontent
|
<!ATTLIST scrapercontent
|
||||||
debug CDATA #IMPLIED
|
debug CDATA #IMPLIED
|
||||||
|
@ -669,6 +669,7 @@ void cTemplateViewChannel::SetViewElements(void) {
|
|||||||
viewElementsAllowed.insert("signalquality");
|
viewElementsAllowed.insert("signalquality");
|
||||||
viewElementsAllowed.insert("signalqualityback");
|
viewElementsAllowed.insert("signalqualityback");
|
||||||
viewElementsAllowed.insert("devices");
|
viewElementsAllowed.insert("devices");
|
||||||
|
viewElementsAllowed.insert("currentweather");
|
||||||
viewElementsAllowed.insert("scrapercontent");
|
viewElementsAllowed.insert("scrapercontent");
|
||||||
viewElementsAllowed.insert("datetime");
|
viewElementsAllowed.insert("datetime");
|
||||||
viewElementsAllowed.insert("time");
|
viewElementsAllowed.insert("time");
|
||||||
@ -715,6 +716,9 @@ string cTemplateViewChannel::GetViewElementName(eViewElement ve) {
|
|||||||
case veDevices:
|
case veDevices:
|
||||||
name = "Devices";
|
name = "Devices";
|
||||||
break;
|
break;
|
||||||
|
case veCurrentWeather:
|
||||||
|
name = "Current Weather";
|
||||||
|
break;
|
||||||
case veScraperContent:
|
case veScraperContent:
|
||||||
name = "Scraper Content";
|
name = "Scraper Content";
|
||||||
break;
|
break;
|
||||||
@ -764,6 +768,8 @@ void cTemplateViewChannel::AddPixmap(string sViewElement, cTemplatePixmap *pix,
|
|||||||
ve = veSignalQualityBack;
|
ve = veSignalQualityBack;
|
||||||
} else if (!sViewElement.compare("devices")) {
|
} else if (!sViewElement.compare("devices")) {
|
||||||
ve = veDevices;
|
ve = veDevices;
|
||||||
|
} else if (!sViewElement.compare("currentweather")) {
|
||||||
|
ve = veCurrentWeather;
|
||||||
} else if (!sViewElement.compare("scrapercontent")) {
|
} else if (!sViewElement.compare("scrapercontent")) {
|
||||||
ve = veScraperContent;
|
ve = veScraperContent;
|
||||||
} else if (!sViewElement.compare("datetime")) {
|
} else if (!sViewElement.compare("datetime")) {
|
||||||
@ -1041,6 +1047,7 @@ void cTemplateViewMenu::SetViewElements(void) {
|
|||||||
viewElementsAllowed.insert("temperatures");
|
viewElementsAllowed.insert("temperatures");
|
||||||
viewElementsAllowed.insert("timers");
|
viewElementsAllowed.insert("timers");
|
||||||
viewElementsAllowed.insert("devices");
|
viewElementsAllowed.insert("devices");
|
||||||
|
viewElementsAllowed.insert("currentweather");
|
||||||
viewElementsAllowed.insert("currentschedule");
|
viewElementsAllowed.insert("currentschedule");
|
||||||
viewElementsAllowed.insert("customtokens");
|
viewElementsAllowed.insert("customtokens");
|
||||||
viewElementsAllowed.insert("scrollbar");
|
viewElementsAllowed.insert("scrollbar");
|
||||||
@ -1252,6 +1259,8 @@ void cTemplateViewMenu::AddPixmap(string sViewElement, cTemplatePixmap *pix, vec
|
|||||||
ve = veCustomTokens;
|
ve = veCustomTokens;
|
||||||
} else if (!sViewElement.compare("devices")) {
|
} else if (!sViewElement.compare("devices")) {
|
||||||
ve = veDevices;
|
ve = veDevices;
|
||||||
|
} else if (!sViewElement.compare("currentweather")) {
|
||||||
|
ve = veCurrentWeather;
|
||||||
} else if (!sViewElement.compare("scrollbar")) {
|
} else if (!sViewElement.compare("scrollbar")) {
|
||||||
ve = veScrollbar;
|
ve = veScrollbar;
|
||||||
} else if (!sViewElement.compare("detailheader")) {
|
} else if (!sViewElement.compare("detailheader")) {
|
||||||
|
@ -26,6 +26,7 @@ enum eViewElement {
|
|||||||
veTime,
|
veTime,
|
||||||
veMessage,
|
veMessage,
|
||||||
veDevices,
|
veDevices,
|
||||||
|
veCurrentWeather,
|
||||||
veCustomTokens,
|
veCustomTokens,
|
||||||
//DisplayChannel ViewElements
|
//DisplayChannel ViewElements
|
||||||
veChannelInfo,
|
veChannelInfo,
|
||||||
|
45
services/weatherforecast.h
Normal file
45
services/weatherforecast.h
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
#ifndef __WEATHERFORECASTSERVICES_H
|
||||||
|
#define __WEATHERFORECASTSERVICES_H
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
class cServiceCurrentWeather {
|
||||||
|
public:
|
||||||
|
cServiceCurrentWeather(void) {
|
||||||
|
timeStamp = "";
|
||||||
|
temperature = "";
|
||||||
|
apparentTemperature = "";
|
||||||
|
summary = "";
|
||||||
|
icon = "";
|
||||||
|
precipitationIntensity = "";
|
||||||
|
precipitationProbability = 0;
|
||||||
|
precipitationType = "";
|
||||||
|
humidity = 0;
|
||||||
|
windSpeed = "";
|
||||||
|
windBearing = 0;
|
||||||
|
windBearingString = "";
|
||||||
|
visibility = "";
|
||||||
|
cloudCover = 0;
|
||||||
|
pressure = "";
|
||||||
|
ozone = "";
|
||||||
|
};
|
||||||
|
std::string timeStamp;
|
||||||
|
std::string temperature;
|
||||||
|
std::string apparentTemperature;
|
||||||
|
std::string summary;
|
||||||
|
std::string icon;
|
||||||
|
std::string precipitationIntensity;
|
||||||
|
int precipitationProbability;
|
||||||
|
std::string precipitationType;
|
||||||
|
int humidity;
|
||||||
|
std::string windSpeed;
|
||||||
|
int windBearing;
|
||||||
|
std::string windBearingString;
|
||||||
|
std::string visibility;
|
||||||
|
int cloudCover;
|
||||||
|
std::string pressure;
|
||||||
|
std::string ozone;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif //__WEATHERFORECASTSERVICES_H
|
||||||
|
|
@ -12,6 +12,11 @@
|
|||||||
<fill color="{clrTransBlack}" />
|
<fill color="{clrTransBlack}" />
|
||||||
<drawrectangle x="0" y="0" width="45%" height="100%" color="{clrTransBlueLight}" />
|
<drawrectangle x="0" y="0" width="45%" height="100%" color="{clrTransBlueLight}" />
|
||||||
</area>
|
</area>
|
||||||
|
<!-- background weather -->
|
||||||
|
<area x="70%" y="15%" width="30%" height="13%" layer="1">
|
||||||
|
<fill color="{clrTransBlack}" />
|
||||||
|
<drawrectangle x="0" y="0" width="45%" height="100%" color="{clrTransBlueLight}" />
|
||||||
|
</area>
|
||||||
<!-- background channellogo -->
|
<!-- background channellogo -->
|
||||||
<area x="0" y="80%" width="20%" height="20%" layer="2">
|
<area x="0" y="80%" width="20%" height="20%" layer="2">
|
||||||
<fill color="{clrTransBlueLight}" />
|
<fill color="{clrTransBlueLight}" />
|
||||||
@ -192,10 +197,10 @@
|
|||||||
{devices[source]} source of the currently tuned channel
|
{devices[source]} source of the currently tuned channel
|
||||||
-->
|
-->
|
||||||
<devices>
|
<devices>
|
||||||
<area x="70%" y="15%" width="30%" height="{areaheight}/12 * {numdevices}" layer="1">
|
<area x="70%" y="30%" width="30%" height="{areaheight}/12 * {numdevices}" layer="1">
|
||||||
<fill color="{clrTransBlack}"/>
|
<fill color="{clrTransBlack}"/>
|
||||||
</area>
|
</area>
|
||||||
<area x="70%" y="15%" width="30%" height="{areaheight}/12 * {numdevices}" layer="2">
|
<area x="70%" y="30%" width="30%" height="{areaheight}/12 * {numdevices}" layer="2">
|
||||||
<loop name="devices" x="0" y="0" orientation="vertical" columnwidth="{areawidth}" rowheight="{areaheight} / {numdevices}" overflow="cut">
|
<loop name="devices" x="0" y="0" orientation="vertical" columnwidth="{areawidth}" rowheight="{areaheight} / {numdevices}" overflow="cut">
|
||||||
<drawtext name="label" x="5" y="0" font="{light}" fontsize="{rowheight}*0.35" color="{clrWhite}" text="{devices[num]}: {devices[type]}" />
|
<drawtext name="label" x="5" y="0" font="{light}" fontsize="{rowheight}*0.35" color="{clrWhite}" text="{devices[num]}: {devices[type]}" />
|
||||||
<drawtext condition="{devices[hascam]}" x="{width(label)} + 15" y="0" font="{light}" fontsize="{rowheight}*0.35" color="{clrWhite}" text="(CAM {devices[cam]})" />
|
<drawtext condition="{devices[hascam]}" x="{width(label)} + 15" y="0" font="{light}" fontsize="{rowheight}*0.35" color="{clrWhite}" text="(CAM {devices[cam]})" />
|
||||||
@ -209,6 +214,33 @@
|
|||||||
</area>
|
</area>
|
||||||
</devices>
|
</devices>
|
||||||
|
|
||||||
|
<!-- Available Variables currentweather:
|
||||||
|
{timestamp} timestamp of forecast in dd.mm hh:mm
|
||||||
|
{temperature} current temperature in °C
|
||||||
|
{apparenttemperature} apparent (feeled) temperature
|
||||||
|
{summary} short weather summary
|
||||||
|
{icon} weather icon
|
||||||
|
{precipitationintensity} precipitation intensity in l/m2
|
||||||
|
{precipitationprobability} precipitation probability in %
|
||||||
|
{precipitationtype} precipitation type
|
||||||
|
{humidity} humidity in %
|
||||||
|
{windspeed} windspeed in km/h
|
||||||
|
{windbearing} wind bearing in °
|
||||||
|
{windbearingstring} wind bearing (N, NE, ...)
|
||||||
|
{visibility} visibility in km
|
||||||
|
{cloudcover} cloud cover in %
|
||||||
|
{pressure} pressure in HPo
|
||||||
|
{ozone} ozone value in DU
|
||||||
|
-->
|
||||||
|
<currentweather>
|
||||||
|
<area x="70%" y="15%" width="13%" height="13%" layer="1">
|
||||||
|
<drawimage imagetype="icon" path="{icon}" align="center" valign="center" width="{areaheight}*0.8" height="{areaheight}*0.8"/>
|
||||||
|
</area>
|
||||||
|
<area x="85%" y="15%" width="13%" height="13%" layer="1">
|
||||||
|
<drawtext align="center" valign="center" font="{light}" fontsize="90%" color="{clrWhite}" text="{temperature}°C" />
|
||||||
|
</area>
|
||||||
|
</currentweather>
|
||||||
|
|
||||||
<!-- Available Variables scrapercontent:
|
<!-- Available Variables scrapercontent:
|
||||||
{posterpath} Full Path of Poster to use in image path attribute
|
{posterpath} Full Path of Poster to use in image path attribute
|
||||||
{posterwidth} width of poster in pixel
|
{posterwidth} width of poster in pixel
|
||||||
|
@ -127,6 +127,27 @@
|
|||||||
<devices>
|
<devices>
|
||||||
</devices>
|
</devices>
|
||||||
|
|
||||||
|
<!-- Available Variables currentweather:
|
||||||
|
{timestamp} timestamp of forecast in dd.mm hh:mm
|
||||||
|
{temperature} current temperature in °C
|
||||||
|
{apparenttemperature} apparent (feeled) temperature
|
||||||
|
{summary} short weather summary
|
||||||
|
{icon} weather icon
|
||||||
|
{precipitationintensity} precipitation intensity in l/m2
|
||||||
|
{precipitationprobability} precipitation probability in %
|
||||||
|
{precipitationtype} precipitation type
|
||||||
|
{humidity} humidity in %
|
||||||
|
{windspeed} windspeed in km/h
|
||||||
|
{windbearing} wind bearing in °
|
||||||
|
{windbearingstring} wind bearing (N, NE, ...)
|
||||||
|
{visibility} visibility in km
|
||||||
|
{cloudcover} cloud cover in %
|
||||||
|
{pressure} pressure in HPo
|
||||||
|
{ozone} ozone value in DU
|
||||||
|
-->
|
||||||
|
<currentweather>
|
||||||
|
</currentweather>
|
||||||
|
|
||||||
<!-- Available Variables scrapercontent:
|
<!-- Available Variables scrapercontent:
|
||||||
{posterpath} Full Path of Poster to use in image path attribute
|
{posterpath} Full Path of Poster to use in image path attribute
|
||||||
{posterwidth} width of poster in pixel
|
{posterwidth} width of poster in pixel
|
||||||
|
@ -539,6 +539,19 @@ void cDisplayChannelView::DrawCustomTokens(void) {
|
|||||||
DrawViewElement(veCustomTokens, &stringTokens, &intTokens);
|
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) {
|
void cDisplayChannelView::Action(void) {
|
||||||
SetInitFinished();
|
SetInitFinished();
|
||||||
FadeIn();
|
FadeIn();
|
||||||
|
@ -51,6 +51,7 @@ public:
|
|||||||
void ClearChannelGroups(void);
|
void ClearChannelGroups(void);
|
||||||
void DisplayMessage(eMessageType Type, const char *Text);
|
void DisplayMessage(eMessageType Type, const char *Text);
|
||||||
void DrawCustomTokens(void);
|
void DrawCustomTokens(void);
|
||||||
|
void DrawCurrentWeather(void);
|
||||||
void DoStart(void) { Start(); };
|
void DoStart(void) { Start(); };
|
||||||
void Flush(void) { DoFlush(); };
|
void Flush(void) { DoFlush(); };
|
||||||
};
|
};
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
#include <vdr/menu.h>
|
#include <vdr/menu.h>
|
||||||
#include "../services/scraper2vdr.h"
|
#include "../services/scraper2vdr.h"
|
||||||
|
#include "../services/weatherforecast.h"
|
||||||
#include "../config.h"
|
#include "../config.h"
|
||||||
#include "../libcore/helpers.h"
|
#include "../libcore/helpers.h"
|
||||||
#include "viewhelpers.h"
|
#include "viewhelpers.h"
|
||||||
@ -425,3 +426,30 @@ bool cViewHelpers::SetDate(map < string, string > &stringTokens, map < string, i
|
|||||||
|
|
||||||
return true;
|
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);
|
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 SetTime(map < string, string > &stringTokens, map < string, int > &intTokens);
|
||||||
bool SetDate(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:
|
public:
|
||||||
cViewHelpers(void);
|
cViewHelpers(void);
|
||||||
virtual ~cViewHelpers(void);
|
virtual ~cViewHelpers(void);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user