[RemoteTimers] add possibility to transfer all timers at once via webif

Use:
http://boxip/control/sendalltimers?ip=10.1.1.xxx&force=1
http://boxip/control/sendalltimers?name=record%20box&force=true

if parameter name is given, it has to be in timerlist as remote box.
if parameter ip and name is given, ip is used.
if parameter force is set, all checks are disabled, and the local timer
will be deleted even the transfer was not successful.
This commit is contained in:
TangoCash
2017-06-15 16:34:19 +02:00
parent 78f1b294a9
commit 7031e99573
4 changed files with 83 additions and 0 deletions

View File

@@ -209,6 +209,7 @@ const CControlAPI::TyCgiCall CControlAPI::yCgiCallList[]=
{"crypt", &CControlAPI::CryptCGI, "text/plain"},
// timer
{"timer", &CControlAPI::TimerCGI, "text/plain"},
{"sendalltimers", &CControlAPI::TimerSendCGI, "text/plain"},
// bouquet editing
{"setbouquet", &CControlAPI::setBouquetCGI, "text/plain"},
{"savebouquet", &CControlAPI::saveBouquetCGI, "text/plain"},
@@ -335,7 +336,34 @@ void CControlAPI::TimerCGI(CyhookHandler *hh)
hh->SendError();
}
void CControlAPI::TimerSendCGI(CyhookHandler *hh)
{
hh->outStart();
if (NeutrinoAPI->Timerd->isTimerdAvailable())
{
if (!hh->ParamList.empty())
{
bool force = (hh->ParamList["force"] == "1") || (hh->ParamList["force"] == "true");
if(!hh->ParamList["ip"].empty())
{
NeutrinoAPI->SendAllTimers(hh->ParamList["ip"],force);
hh->SendOk();
}
else if(!hh->ParamList["name"].empty())
{
NeutrinoAPI->SendAllTimers(NeutrinoAPI->GetRemoteBoxIP(decodeString(hh->ParamList["name"])),force);
hh->SendOk();
}
else
hh->SendError();
}
}
else
hh->SendError();
}
//-----------------------------------------------------------------------------
void CControlAPI::SetModeCGI(CyhookHandler *hh)
{
if (!(hh->ParamList.empty()))