summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlouis <louis.braun@gmx.de>2015-01-13 09:01:11 +0100
committerlouis <louis.braun@gmx.de>2015-01-13 09:01:11 +0100
commit4d8d1cc629ce5db3862aac75baafa0d1dae69b21 (patch)
tree4850c485c72b61d7576dc6698e6ae8faba44e53f
parentc59cc4e6103c38897ceba54b6a88e6934147f263 (diff)
downloadvdr-plugin-skindesigner-4d8d1cc629ce5db3862aac75baafa0d1dae69b21.tar.gz
vdr-plugin-skindesigner-4d8d1cc629ce5db3862aac75baafa0d1dae69b21.tar.bz2
introduced weather service interface
-rw-r--r--displaychannel.c1
-rw-r--r--dtd/displaychannel.dtd7
-rw-r--r--libtemplate/templateview.c9
-rw-r--r--libtemplate/templateviewelement.h1
-rw-r--r--services/weatherforecast.h45
-rw-r--r--skins/metrixhd/xmlfiles/displaychannel.xml36
-rw-r--r--skinskeleton/xmlfiles/displaychannel.xml21
-rw-r--r--views/displaychannelview.c13
-rw-r--r--views/displaychannelview.h1
-rw-r--r--views/viewhelpers.c28
-rw-r--r--views/viewhelpers.h1
11 files changed, 160 insertions, 3 deletions
diff --git a/displaychannel.c b/displaychannel.c
index 941e2fa..6d5d40c 100644
--- a/displaychannel.c
+++ b/displaychannel.c
@@ -169,6 +169,7 @@ void cSDDisplayChannel::Flush(void) {
return;
if (initial) {
+ channelView->DrawCurrentWeather();
channelView->DrawCustomTokens();
}
diff --git a/dtd/displaychannel.dtd b/dtd/displaychannel.dtd
index f9664b0..c3d3761 100644
--- a/dtd/displaychannel.dtd
+++ b/dtd/displaychannel.dtd
@@ -4,7 +4,7 @@
<!ELEMENT displaychannel (background | channelinfo | epginfo | progressbar | progressbarback |
statusinfo | audioinfo | screenresolution | channelgroup |
- signalquality | signalqualityback | devices | scrapercontent |
+ signalquality | signalqualityback | devices | currentweather | scrapercontent |
datetime | time | message | customtokens)* >
<!ATTLIST displaychannel
x CDATA #REQUIRED
@@ -78,6 +78,11 @@
debug CDATA #IMPLIED
>
+<!ELEMENT currentweather (area|areascroll)*>
+<!ATTLIST currentweather
+ debug CDATA #IMPLIED
+>
+
<!ELEMENT scrapercontent (area|areascroll)*>
<!ATTLIST scrapercontent
debug CDATA #IMPLIED
diff --git a/libtemplate/templateview.c b/libtemplate/templateview.c
index 7b64f3d..8410b66 100644
--- a/libtemplate/templateview.c
+++ b/libtemplate/templateview.c
@@ -669,6 +669,7 @@ void cTemplateViewChannel::SetViewElements(void) {
viewElementsAllowed.insert("signalquality");
viewElementsAllowed.insert("signalqualityback");
viewElementsAllowed.insert("devices");
+ viewElementsAllowed.insert("currentweather");
viewElementsAllowed.insert("scrapercontent");
viewElementsAllowed.insert("datetime");
viewElementsAllowed.insert("time");
@@ -715,6 +716,9 @@ string cTemplateViewChannel::GetViewElementName(eViewElement ve) {
case veDevices:
name = "Devices";
break;
+ case veCurrentWeather:
+ name = "Current Weather";
+ break;
case veScraperContent:
name = "Scraper Content";
break;
@@ -764,6 +768,8 @@ void cTemplateViewChannel::AddPixmap(string sViewElement, cTemplatePixmap *pix,
ve = veSignalQualityBack;
} else if (!sViewElement.compare("devices")) {
ve = veDevices;
+ } else if (!sViewElement.compare("currentweather")) {
+ ve = veCurrentWeather;
} else if (!sViewElement.compare("scrapercontent")) {
ve = veScraperContent;
} else if (!sViewElement.compare("datetime")) {
@@ -1041,6 +1047,7 @@ void cTemplateViewMenu::SetViewElements(void) {
viewElementsAllowed.insert("temperatures");
viewElementsAllowed.insert("timers");
viewElementsAllowed.insert("devices");
+ viewElementsAllowed.insert("currentweather");
viewElementsAllowed.insert("currentschedule");
viewElementsAllowed.insert("customtokens");
viewElementsAllowed.insert("scrollbar");
@@ -1252,6 +1259,8 @@ void cTemplateViewMenu::AddPixmap(string sViewElement, cTemplatePixmap *pix, vec
ve = veCustomTokens;
} else if (!sViewElement.compare("devices")) {
ve = veDevices;
+ } else if (!sViewElement.compare("currentweather")) {
+ ve = veCurrentWeather;
} else if (!sViewElement.compare("scrollbar")) {
ve = veScrollbar;
} else if (!sViewElement.compare("detailheader")) {
diff --git a/libtemplate/templateviewelement.h b/libtemplate/templateviewelement.h
index 71c9c74..744c87a 100644
--- a/libtemplate/templateviewelement.h
+++ b/libtemplate/templateviewelement.h
@@ -26,6 +26,7 @@ enum eViewElement {
veTime,
veMessage,
veDevices,
+ veCurrentWeather,
veCustomTokens,
//DisplayChannel ViewElements
veChannelInfo,
diff --git a/services/weatherforecast.h b/services/weatherforecast.h
new file mode 100644
index 0000000..c3f6b48
--- /dev/null
+++ b/services/weatherforecast.h
@@ -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
+
diff --git a/skins/metrixhd/xmlfiles/displaychannel.xml b/skins/metrixhd/xmlfiles/displaychannel.xml
index 4effefb..fdf2aea 100644
--- a/skins/metrixhd/xmlfiles/displaychannel.xml
+++ b/skins/metrixhd/xmlfiles/displaychannel.xml
@@ -12,6 +12,11 @@
<fill color="{clrTransBlack}" />
<drawrectangle x="0" y="0" width="45%" height="100%" color="{clrTransBlueLight}" />
</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 -->
<area x="0" y="80%" width="20%" height="20%" layer="2">
<fill color="{clrTransBlueLight}" />
@@ -192,10 +197,10 @@
{devices[source]} source of the currently tuned channel
-->
<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}"/>
</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">
<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]})" />
@@ -209,6 +214,33 @@
</area>
</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:
{posterpath} Full Path of Poster to use in image path attribute
{posterwidth} width of poster in pixel
diff --git a/skinskeleton/xmlfiles/displaychannel.xml b/skinskeleton/xmlfiles/displaychannel.xml
index 925e9ec..ccd5c2f 100644
--- a/skinskeleton/xmlfiles/displaychannel.xml
+++ b/skinskeleton/xmlfiles/displaychannel.xml
@@ -127,6 +127,27 @@
<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:
{posterpath} Full Path of Poster to use in image path attribute
{posterwidth} width of poster in pixel
diff --git a/views/displaychannelview.c b/views/displaychannelview.c
index dc4eeea..6526530 100644
--- a/views/displaychannelview.c
+++ b/views/displaychannelview.c
@@ -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();
diff --git a/views/displaychannelview.h b/views/displaychannelview.h
index bae9910..5990232 100644
--- a/views/displaychannelview.h
+++ b/views/displaychannelview.h
@@ -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(); };
};
diff --git a/views/viewhelpers.c b/views/viewhelpers.c
index af56b5b..af2233a 100644
--- a/views/viewhelpers.c
+++ b/views/viewhelpers.c
@@ -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", &currentWeather)) {
+ 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));
+}
diff --git a/views/viewhelpers.h b/views/viewhelpers.h
index 2b3167b..82dd7c9 100644
--- a/views/viewhelpers.h
+++ b/views/viewhelpers.h
@@ -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);