add weather via Dark Sky API -step1-

Origin commit data
------------------
Branch: ni/coolstream
Commit: ed4d4e0c46
Author: TangoCash <eric@loxat.de>
Date: 2019-03-20 (Wed, 20 Mar 2019)


------------------
No further description and justification available within origin commit message!

------------------
This commit was generated by Migit
This commit is contained in:
TangoCash
2019-03-20 15:27:14 +01:00
committed by vanhofen
parent abf08f7ee8
commit b091b77794
30 changed files with 755 additions and 6 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
@@ -52,6 +52,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 "/var/run/lcd4linux.pid"
@@ -249,6 +253,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);
@@ -1008,6 +1015,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;
}
}
}
/* ----------------------------------------------------------------- */