Merge branch 'master' into pu/mp

This commit is contained in:
Jacek Jendrzej
2017-06-16 14:19:26 +02:00
21 changed files with 207 additions and 180 deletions

View File

@@ -27,6 +27,8 @@
#include <driver/rcinput.h>
#include <driver/screen_max.h>
#include <driver/pictureviewer/pictureviewer.h>
#include <system/httptool.h>
#include <system/helpers.h>
#include <gui/color.h>
#include <gui/widget/icons.h>
#include <gui/movieplayer.h>
@@ -530,3 +532,53 @@ std::string CNeutrinoAPI::getLogoFile(t_channel_id channelId)
return logoString;
return "";
}
std::string CNeutrinoAPI::GetRemoteBoxIP(std::string _rbname)
{
std::string c_url = "";
for (std::vector<timer_remotebox_item>::iterator it = g_settings.timer_remotebox_ip.begin(); it != g_settings.timer_remotebox_ip.end(); ++it)
{
if (it->rbname == _rbname)
{
if (!it->user.empty() && !it->pass.empty())
c_url += it->user + ":" + it->pass +"@";
c_url += it->rbaddress;
c_url += ":" + to_string(it->port);
break;
}
}
return c_url;
}
void CNeutrinoAPI::SendAllTimers(std::string url, bool force)
{
CTimerd::TimerList timerlist;
timerlist.clear();
Timerd->getTimerList(timerlist);
sort(timerlist.begin(), timerlist.end());
int pre,post;
Timerd->getRecordingSafety(pre,post);
CHTTPTool httpTool;
std::string r_url;
for(CTimerd::TimerList::iterator timer = timerlist.begin(); timer != timerlist.end(); ++timer)
{
if (timer->eventType == CTimerd::TIMER_RECORD) {
r_url = "http://";
r_url += url;
r_url += "/control/timer?action=new";
r_url += "&alarm=" + to_string((int)timer->alarmTime + pre);
r_url += "&stop=" + to_string((int)timer->stopTime - post);
r_url += "&announce=" + to_string((int)timer->announceTime + pre);
r_url += "&channel_id=" + string_printf(PRINTF_CHANNEL_ID_TYPE_NO_LEADING_ZEROS, timer->channel_id);
r_url += "&aj=on";
r_url += "&rs=on";
r_url = httpTool.downloadString(r_url, -1, 300);
if ((r_url=="ok") || force)
Timerd->removeTimerEvent(timer->eventID);
}
}
}