add weather via Dark Sky API -step1-

Signed-off-by: Thilo Graf <dbt@novatux.de>

Build errors fixed, missing code disabled
This commit is contained in:
TangoCash
2019-03-20 15:27:14 +01:00
committed by Thilo Graf
parent 69ae7d89e3
commit f7219894bc
31 changed files with 786 additions and 7 deletions

View File

@@ -7,7 +7,7 @@
Copyright (C) 2012-2018 'vanhofen'
Homepage: http://www.neutrino-images.de/
Copyright (C) 2016-2018 'TangoCash'
Copyright (C) 2016-2019 'TangoCash'
License: GPL
@@ -54,6 +54,7 @@
#include <gui/pictureviewer.h>
#include <eitd/sectionsd.h>
#include <hardware/video.h>
#include <gui/weather.h>
#include "lcd4l.h"
@@ -103,6 +104,9 @@ extern CPictureViewer *g_PicViewer;
#define FCOLOR2 LCD_DATADIR "fcolor2"
#define PBCOLOR LCD_DATADIR "pbcolor"
#define WEATHER_TEMP LCD_DATADIR "weather_temp"
#define WEATHER_ICON LCD_DATADIR "weather_icon"
#define FLAG_LCD4LINUX "/tmp/.lcd4linux"
#define PIDFILE "/tmp/lcd4linux.pid"
#define PNGFILE "/tmp/lcd4linux.png"
@@ -294,6 +298,9 @@ void CLCD4l::Init()
m_Start = "00:00";
m_End = "00:00";
m_wtemp = "";
m_wicon = "";
if (!access(LCD_DATADIR, F_OK) == 0)
mkdir(LCD_DATADIR, 0755);
@@ -1045,6 +1052,23 @@ void CLCD4l::ParseInfo(uint64_t parseID, bool newID, bool firstRun)
WriteFile(DURATION, (std::string)Duration);
strcpy(m_Duration, Duration);
}
if (g_settings.weather_enabled && CWeather::getInstance()->checkUpdate())
{
std::string wtemp = CWeather::getInstance()->getActTemp();
std::string wicon = CWeather::getInstance()->getActIcon();
if (m_wtemp.compare(wtemp))
{
WriteFile(WEATHER_TEMP, wtemp);
m_wtemp = wtemp;
}
if (m_wicon.compare(wicon))
{
WriteFile(WEATHER_ICON, wicon);
m_wicon = wicon;
}
}
}
/* ----------------------------------------------------------------- */