mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-29 08:21:12 +02:00
-add hwinfo to httpd info
git-svn-id: file:///home/bas/coolstream_public_svn/THIRDPARTY/applications/neutrino-experimental@976 e54a6e83-5905-42d5-8d5c-058d10e6a962
This commit is contained in:
@@ -31,6 +31,8 @@
|
|||||||
#include <zapit/channel.h>
|
#include <zapit/channel.h>
|
||||||
#include <zapit/bouquets.h>
|
#include <zapit/bouquets.h>
|
||||||
#include <configfile.h>
|
#include <configfile.h>
|
||||||
|
#include <cs_api.h>
|
||||||
|
#include <global.h>
|
||||||
// yhttpd
|
// yhttpd
|
||||||
#include "yhttpd.h"
|
#include "yhttpd.h"
|
||||||
#include "ytypes_globals.h"
|
#include "ytypes_globals.h"
|
||||||
@@ -235,7 +237,7 @@ void CControlAPI::Execute(CyhookHandler *hh)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// get function index
|
// get function index
|
||||||
for(unsigned int i = 0;i < (sizeof(yCgiCallList)/sizeof(yCgiCallList[0])); i++)
|
for(unsigned int i = 0; i < (sizeof(yCgiCallList)/sizeof(yCgiCallList[0])); i++)
|
||||||
if (filename == yCgiCallList[i].func_name)
|
if (filename == yCgiCallList[i].func_name)
|
||||||
{
|
{
|
||||||
index = i;
|
index = i;
|
||||||
@@ -387,7 +389,7 @@ void CControlAPI::ExecCGI(CyhookHandler *hh)
|
|||||||
{
|
{
|
||||||
script = hh->ParamList["1"];
|
script = hh->ParamList["1"];
|
||||||
unsigned int len = hh->ParamList.size();
|
unsigned int len = hh->ParamList.size();
|
||||||
for(unsigned int y=2;y<=len;y++)
|
for(unsigned int y=2; y<=len; y++)
|
||||||
if(!hh->ParamList[itoa(y)].empty())
|
if(!hh->ParamList[itoa(y)].empty())
|
||||||
{
|
{
|
||||||
script += " ";
|
script += " ";
|
||||||
@@ -559,7 +561,7 @@ void CControlAPI::MessageCGI(CyhookHandler *hh)
|
|||||||
void CControlAPI::InfoCGI(CyhookHandler *hh)
|
void CControlAPI::InfoCGI(CyhookHandler *hh)
|
||||||
{
|
{
|
||||||
if (hh->ParamList.empty())
|
if (hh->ParamList.empty())
|
||||||
hh->Write("Neutrino\n");
|
hh->Write("Neutrino HD\n");
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (hh->ParamList["1"] == "streaminfo") // print streaminfo
|
if (hh->ParamList["1"] == "streaminfo") // print streaminfo
|
||||||
@@ -570,10 +572,47 @@ void CControlAPI::InfoCGI(CyhookHandler *hh)
|
|||||||
hh->Write("3");
|
hh->Write("3");
|
||||||
else if (hh->ParamList["1"] == "nhttpd_version")// print nhttpd version
|
else if (hh->ParamList["1"] == "nhttpd_version")// print nhttpd version
|
||||||
hh->printf("%s\n", HTTPD_VERSION);
|
hh->printf("%s\n", HTTPD_VERSION);
|
||||||
|
else if (hh->ParamList["1"] == "hwinfo")// print nhttpd version
|
||||||
|
HWInfoCGI(hh);
|
||||||
else
|
else
|
||||||
hh->SendError();
|
hh->SendError();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CControlAPI::HWInfoCGI(CyhookHandler *hh)
|
||||||
|
{
|
||||||
|
unsigned int system_rev = cs_get_revision();
|
||||||
|
std::string boxname;
|
||||||
|
boxname = "Coolstream ";
|
||||||
|
switch(system_rev)
|
||||||
|
{
|
||||||
|
case 6:
|
||||||
|
boxname += "HD1";
|
||||||
|
break;
|
||||||
|
case 7:
|
||||||
|
boxname += "BSE";
|
||||||
|
break;
|
||||||
|
case 8:
|
||||||
|
case 9:
|
||||||
|
boxname += "Neo";
|
||||||
|
break;
|
||||||
|
case 10:
|
||||||
|
boxname += "Zee";
|
||||||
|
break;
|
||||||
|
|
||||||
|
default: {
|
||||||
|
char buffer[10];
|
||||||
|
snprintf(buffer, sizeof(buffer), "%u\n", system_rev);
|
||||||
|
boxname += "Unknown nr. ";
|
||||||
|
boxname += buffer;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
boxname += (g_info.delivery_system == DVB_S) ? " SAT":" CABLE";
|
||||||
|
hh->printf("%s\n", boxname.c_str());
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
void CControlAPI::ShutdownCGI(CyhookHandler *hh)
|
void CControlAPI::ShutdownCGI(CyhookHandler *hh)
|
||||||
{
|
{
|
||||||
@@ -821,8 +860,8 @@ void CControlAPI::ChannellistCGI(CyhookHandler *hh)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
void CControlAPI::_GetBouquetWriteItem(CyhookHandler *hh, CZapitChannel * channel, int bouquetNr, int nr){
|
void CControlAPI::_GetBouquetWriteItem(CyhookHandler *hh, CZapitChannel * channel, int bouquetNr, int nr) {
|
||||||
if (hh->ParamList["format"] == "json"){
|
if (hh->ParamList["format"] == "json") {
|
||||||
hh->printf("\t\t{'number': '%u', 'id': '"
|
hh->printf("\t\t{'number': '%u', 'id': '"
|
||||||
PRINTF_CHANNEL_ID_TYPE_NO_LEADING_ZEROS
|
PRINTF_CHANNEL_ID_TYPE_NO_LEADING_ZEROS
|
||||||
"', 'short_id': '"
|
"', 'short_id': '"
|
||||||
@@ -836,7 +875,7 @@ void CControlAPI::_GetBouquetWriteItem(CyhookHandler *hh, CZapitChannel * channe
|
|||||||
bouquetNr
|
bouquetNr
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else if((hh->ParamList["format"] == "xml") || !(hh->ParamList["xml"].empty()) ){
|
else if((hh->ParamList["format"] == "xml") || !(hh->ParamList["xml"].empty()) ) {
|
||||||
hh->printf("<channel>\n\t<number>%u</number>\n\t<bouquet>%d</bouquet>\n\t<id>"
|
hh->printf("<channel>\n\t<number>%u</number>\n\t<bouquet>%d</bouquet>\n\t<id>"
|
||||||
PRINTF_CHANNEL_ID_TYPE_NO_LEADING_ZEROS
|
PRINTF_CHANNEL_ID_TYPE_NO_LEADING_ZEROS
|
||||||
"</id>\n\t<short_id>"
|
"</id>\n\t<short_id>"
|
||||||
@@ -850,7 +889,7 @@ void CControlAPI::_GetBouquetWriteItem(CyhookHandler *hh, CZapitChannel * channe
|
|||||||
NeutrinoAPI->getLogoFile(hh->WebserverConfigList["Tuxbox.LogosURL"], channel->channel_id).c_str()
|
NeutrinoAPI->getLogoFile(hh->WebserverConfigList["Tuxbox.LogosURL"], channel->channel_id).c_str()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else{
|
else {
|
||||||
hh->printf("%u "
|
hh->printf("%u "
|
||||||
PRINTF_CHANNEL_ID_TYPE_NO_LEADING_ZEROS
|
PRINTF_CHANNEL_ID_TYPE_NO_LEADING_ZEROS
|
||||||
" %s\n",
|
" %s\n",
|
||||||
@@ -889,17 +928,17 @@ void CControlAPI::GetBouquetCGI(CyhookHandler *hh)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// write header
|
// write header
|
||||||
if (hh->ParamList["format"] == "json"){
|
if (hh->ParamList["format"] == "json") {
|
||||||
hh->WriteLn("{");
|
hh->WriteLn("{");
|
||||||
}
|
}
|
||||||
else if((hh->ParamList["format"] == "xml") || !(hh->ParamList["xml"].empty()) ){
|
else if((hh->ParamList["format"] == "xml") || !(hh->ParamList["xml"].empty()) ) {
|
||||||
hh->WriteLn("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
|
hh->WriteLn("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
|
||||||
hh->WriteLn("<channellist>");
|
hh->WriteLn("<channellist>");
|
||||||
// hh->printf("<bouquet>\n\t<bnumber>%s</bnumber>\n</bouquet>\n",hh->ParamList["bouquet"].c_str());
|
// hh->printf("<bouquet>\n\t<bnumber>%s</bnumber>\n</bouquet>\n",hh->ParamList["bouquet"].c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
ZapitChannelList channels;
|
ZapitChannelList channels;
|
||||||
if(hh->ParamList["bouquet"] != ""){
|
if(hh->ParamList["bouquet"] != "") {
|
||||||
// list for given bouquet
|
// list for given bouquet
|
||||||
int BouquetNr = atoi(hh->ParamList["bouquet"].c_str());
|
int BouquetNr = atoi(hh->ParamList["bouquet"].c_str());
|
||||||
if(BouquetNr > 0)
|
if(BouquetNr > 0)
|
||||||
@@ -913,7 +952,7 @@ void CControlAPI::GetBouquetCGI(CyhookHandler *hh)
|
|||||||
} else {
|
} else {
|
||||||
// list all
|
// list all
|
||||||
for (int i = 0; i < (int) g_bouquetManager->Bouquets.size(); i++) {
|
for (int i = 0; i < (int) g_bouquetManager->Bouquets.size(); i++) {
|
||||||
/*
|
/*
|
||||||
CBouquetManager::ChannelIterator cit = mode == CZapitClient::MODE_RADIO ? g_bouquetManager->radioChannelsBegin() : g_bouquetManager->tvChannelsBegin();
|
CBouquetManager::ChannelIterator cit = mode == CZapitClient::MODE_RADIO ? g_bouquetManager->radioChannelsBegin() : g_bouquetManager->tvChannelsBegin();
|
||||||
for (; !(cit.EndOfChannels()); cit++) {
|
for (; !(cit.EndOfChannels()); cit++) {
|
||||||
CZapitChannel * channel = *cit;*/
|
CZapitChannel * channel = *cit;*/
|
||||||
@@ -960,7 +999,7 @@ void CControlAPI::GetBouquetsCGI(CyhookHandler *hh)
|
|||||||
// write header
|
// write header
|
||||||
if (hh->ParamList["format"] == "json")
|
if (hh->ParamList["format"] == "json")
|
||||||
hh->WriteLn("{");
|
hh->WriteLn("{");
|
||||||
else if (hh->ParamList["format"] == "xml"){
|
else if (hh->ParamList["format"] == "xml") {
|
||||||
hh->WriteLn("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
|
hh->WriteLn("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
|
||||||
hh->WriteLn("<bouquets>");
|
hh->WriteLn("<bouquets>");
|
||||||
}
|
}
|
||||||
@@ -969,7 +1008,7 @@ void CControlAPI::GetBouquetsCGI(CyhookHandler *hh)
|
|||||||
std::string bouquet;
|
std::string bouquet;
|
||||||
for (int i = 0; i < (int) g_bouquetManager->Bouquets.size(); i++) {
|
for (int i = 0; i < (int) g_bouquetManager->Bouquets.size(); i++) {
|
||||||
ZapitChannelList * channels = mode == CZapitClient::MODE_RADIO ? &g_bouquetManager->Bouquets[i]->radioChannels : &g_bouquetManager->Bouquets[i]->tvChannels;
|
ZapitChannelList * channels = mode == CZapitClient::MODE_RADIO ? &g_bouquetManager->Bouquets[i]->radioChannels : &g_bouquetManager->Bouquets[i]->tvChannels;
|
||||||
if(!channels->empty() && (!g_bouquetManager->Bouquets[i]->bHidden || show_hidden)){
|
if(!channels->empty() && (!g_bouquetManager->Bouquets[i]->bHidden || show_hidden)) {
|
||||||
bouquet = std::string(g_bouquetManager->Bouquets[i]->bFav ? g_Locale->getText(LOCALE_FAVORITES_BOUQUETNAME) :g_bouquetManager->Bouquets[i]->Name.c_str());
|
bouquet = std::string(g_bouquetManager->Bouquets[i]->bFav ? g_Locale->getText(LOCALE_FAVORITES_BOUQUETNAME) :g_bouquetManager->Bouquets[i]->Name.c_str());
|
||||||
if(encode)
|
if(encode)
|
||||||
bouquet = encodeString(bouquet); // encode (URLencode) the bouquetname
|
bouquet = encodeString(bouquet); // encode (URLencode) the bouquetname
|
||||||
@@ -1185,8 +1224,7 @@ void CControlAPI::EpgCGI(CyhookHandler *hh)
|
|||||||
|
|
||||||
if(hh->ParamList["bouquetnr"] == "all")
|
if(hh->ParamList["bouquetnr"] == "all")
|
||||||
all_bouquets = true;
|
all_bouquets = true;
|
||||||
else
|
else if (!(hh->ParamList["bouquetnr"].empty()))
|
||||||
if (!(hh->ParamList["bouquetnr"].empty()))
|
|
||||||
{
|
{
|
||||||
bouquetnr = atoi( hh->ParamList["bouquetnr"].c_str() );
|
bouquetnr = atoi( hh->ParamList["bouquetnr"].c_str() );
|
||||||
bouquetnr--;
|
bouquetnr--;
|
||||||
@@ -1306,7 +1344,7 @@ void CControlAPI::ZaptoCGI(CyhookHandler *hh)
|
|||||||
sectionsd_getCurrentNextServiceKey(current_channel&0xFFFFFFFFFFFFULL, currentNextInfo);
|
sectionsd_getCurrentNextServiceKey(current_channel&0xFFFFFFFFFFFFULL, currentNextInfo);
|
||||||
if (sectionsd_getLinkageDescriptorsUniqueKey(currentNextInfo.current_uniqueKey,desc))
|
if (sectionsd_getLinkageDescriptorsUniqueKey(currentNextInfo.current_uniqueKey,desc))
|
||||||
{
|
{
|
||||||
for(unsigned int i=0;i< desc.size();i++)
|
for(unsigned int i=0; i< desc.size(); i++)
|
||||||
{
|
{
|
||||||
t_channel_id sub_channel_id =
|
t_channel_id sub_channel_id =
|
||||||
CREATE_CHANNEL_ID_FROM_SERVICE_ORIGINALNETWORK_TRANSPORTSTREAM_ID(
|
CREATE_CHANNEL_ID_FROM_SERVICE_ORIGINALNETWORK_TRANSPORTSTREAM_ID(
|
||||||
@@ -1508,7 +1546,7 @@ void CControlAPI::SendTimers(CyhookHandler *hh)
|
|||||||
|
|
||||||
CTimerd::TimerList::iterator timer = timerlist.begin();
|
CTimerd::TimerList::iterator timer = timerlist.begin();
|
||||||
|
|
||||||
for(; timer != timerlist.end();timer++)
|
for(; timer != timerlist.end(); timer++)
|
||||||
{
|
{
|
||||||
// Add Data
|
// Add Data
|
||||||
char zAddData[22+1] = { 0 };
|
char zAddData[22+1] = { 0 };
|
||||||
@@ -1563,7 +1601,7 @@ void CControlAPI::SendTimers(CyhookHandler *hh)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
void CControlAPI::_SendTime(CyhookHandler *hh, struct tm *Time, int digits){
|
void CControlAPI::_SendTime(CyhookHandler *hh, struct tm *Time, int digits) {
|
||||||
char zTime[25] = {0};
|
char zTime[25] = {0};
|
||||||
char zDate[25] = {0};
|
char zDate[25] = {0};
|
||||||
strftime(zTime,20,"%H:%M",Time);
|
strftime(zTime,20,"%H:%M",Time);
|
||||||
@@ -1609,7 +1647,7 @@ void CControlAPI::SendTimersXML(CyhookHandler *hh)
|
|||||||
// start timer list
|
// start timer list
|
||||||
hh->WriteLn("\t<timer_list>\n");
|
hh->WriteLn("\t<timer_list>\n");
|
||||||
|
|
||||||
for(; timer != timerlist.end();timer++)
|
for(; timer != timerlist.end(); timer++)
|
||||||
{
|
{
|
||||||
hh->WriteLn("\t\t<timer>\n");
|
hh->WriteLn("\t\t<timer>\n");
|
||||||
hh->printf("\t\t\t<type>%s</type>\n",(NeutrinoAPI->timerEventType2Str(timer->eventType)).c_str());
|
hh->printf("\t\t\t<type>%s</type>\n",(NeutrinoAPI->timerEventType2Str(timer->eventType)).c_str());
|
||||||
@@ -1649,7 +1687,7 @@ void CControlAPI::SendTimersXML(CyhookHandler *hh)
|
|||||||
hh->WriteLn("\t\t\t</announce>\n");
|
hh->WriteLn("\t\t\t</announce>\n");
|
||||||
|
|
||||||
// stoptime
|
// stoptime
|
||||||
if(timer->stopTime > 0){
|
if(timer->stopTime > 0) {
|
||||||
hh->WriteLn("\t\t\t<stop>\n");
|
hh->WriteLn("\t\t\t<stop>\n");
|
||||||
struct tm *stopTime = localtime(&(timer->stopTime));
|
struct tm *stopTime = localtime(&(timer->stopTime));
|
||||||
hh->WriteLn("\t\t\t\t<normal>\n");
|
hh->WriteLn("\t\t\t\t<normal>\n");
|
||||||
@@ -1676,7 +1714,7 @@ void CControlAPI::SendTimersXML(CyhookHandler *hh)
|
|||||||
hh->printf("\t\t\t\t<count>%s</count>\n",zRepCount.c_str());
|
hh->printf("\t\t\t\t<count>%s</count>\n",zRepCount.c_str());
|
||||||
hh->printf("\t\t\t\t<number>%d</number>\n",(int)timer->eventRepeat);
|
hh->printf("\t\t\t\t<number>%d</number>\n",(int)timer->eventRepeat);
|
||||||
hh->printf("\t\t\t\t<text>%s</text>\n",zRep.c_str());
|
hh->printf("\t\t\t\t<text>%s</text>\n",zRep.c_str());
|
||||||
char weekdays[8]={0};
|
char weekdays[8]= {0};
|
||||||
NeutrinoAPI->Timerd->setWeekdaysToStr(timer->eventRepeat, weekdays);
|
NeutrinoAPI->Timerd->setWeekdaysToStr(timer->eventRepeat, weekdays);
|
||||||
hh->printf("\t\t\t\t<weekdays>%s</weekdays>\n",weekdays);
|
hh->printf("\t\t\t\t<weekdays>%s</weekdays>\n",weekdays);
|
||||||
hh->WriteLn("\t\t\t</repeat>\n");
|
hh->WriteLn("\t\t\t</repeat>\n");
|
||||||
@@ -1688,7 +1726,7 @@ void CControlAPI::SendTimersXML(CyhookHandler *hh)
|
|||||||
|
|
||||||
// epg title
|
// epg title
|
||||||
std::string title = timer->epgTitle;
|
std::string title = timer->epgTitle;
|
||||||
if(timer->epgID!=0){
|
if(timer->epgID!=0) {
|
||||||
CSectionsdClient sdc;
|
CSectionsdClient sdc;
|
||||||
CEPGData epgdata;
|
CEPGData epgdata;
|
||||||
if (sdc.getEPGid(timer->epgID, timer->epg_starttime, &epgdata))
|
if (sdc.getEPGid(timer->epgID, timer->epg_starttime, &epgdata))
|
||||||
@@ -1698,27 +1736,27 @@ void CControlAPI::SendTimersXML(CyhookHandler *hh)
|
|||||||
// timer specific data
|
// timer specific data
|
||||||
switch(timer->eventType)
|
switch(timer->eventType)
|
||||||
{
|
{
|
||||||
case CTimerd::TIMER_NEXTPROGRAM :{
|
case CTimerd::TIMER_NEXTPROGRAM : {
|
||||||
hh->printf("\t\t\t<channel_id>" PRINTF_CHANNEL_ID_TYPE_NO_LEADING_ZEROS "</channel_id>\n",timer->channel_id);
|
hh->printf("\t\t\t<channel_id>" PRINTF_CHANNEL_ID_TYPE_NO_LEADING_ZEROS "</channel_id>\n",timer->channel_id);
|
||||||
hh->printf("\t\t\t<channel_name>%s</channel_name>\n",channel_name.c_str());
|
hh->printf("\t\t\t<channel_name>%s</channel_name>\n",channel_name.c_str());
|
||||||
hh->printf("\t\t\t<title>%s</title>\n",title.c_str());
|
hh->printf("\t\t\t<title>%s</title>\n",title.c_str());
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CTimerd::TIMER_ZAPTO :{
|
case CTimerd::TIMER_ZAPTO : {
|
||||||
hh->printf("\t\t\t<channel_id>" PRINTF_CHANNEL_ID_TYPE_NO_LEADING_ZEROS "</channel_id>\n",timer->channel_id);
|
hh->printf("\t\t\t<channel_id>" PRINTF_CHANNEL_ID_TYPE_NO_LEADING_ZEROS "</channel_id>\n",timer->channel_id);
|
||||||
hh->printf("\t\t\t<channel_name>%s</channel_name>\n",channel_name.c_str());
|
hh->printf("\t\t\t<channel_name>%s</channel_name>\n",channel_name.c_str());
|
||||||
hh->printf("\t\t\t<title>%s</title>\n",title.c_str());
|
hh->printf("\t\t\t<title>%s</title>\n",title.c_str());
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CTimerd::TIMER_RECORD :{
|
case CTimerd::TIMER_RECORD : {
|
||||||
hh->printf("\t\t\t<channel_id>" PRINTF_CHANNEL_ID_TYPE_NO_LEADING_ZEROS "</channel_id>\n",timer->channel_id);
|
hh->printf("\t\t\t<channel_id>" PRINTF_CHANNEL_ID_TYPE_NO_LEADING_ZEROS "</channel_id>\n",timer->channel_id);
|
||||||
hh->printf("\t\t\t<channel_name>%s</channel_name>\n",channel_name.c_str());
|
hh->printf("\t\t\t<channel_name>%s</channel_name>\n",channel_name.c_str());
|
||||||
hh->printf("\t\t\t<title>%s</title>\n",title.c_str());
|
hh->printf("\t\t\t<title>%s</title>\n",title.c_str());
|
||||||
|
|
||||||
// audio
|
// audio
|
||||||
if(timer->apids != TIMERD_APIDS_CONF){
|
if(timer->apids != TIMERD_APIDS_CONF) {
|
||||||
hh->WriteLn("\t\t\t<audio>\n");
|
hh->WriteLn("\t\t\t<audio>\n");
|
||||||
hh->WriteLn("\t\t\t\t<apids_conf>false</apids_conf>\n");
|
hh->WriteLn("\t\t\t\t<apids_conf>false</apids_conf>\n");
|
||||||
if(timer->apids & TIMERD_APIDS_STD)
|
if(timer->apids & TIMERD_APIDS_STD)
|
||||||
@@ -1750,32 +1788,33 @@ void CControlAPI::SendTimersXML(CyhookHandler *hh)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CTimerd::TIMER_STANDBY :{
|
case CTimerd::TIMER_STANDBY : {
|
||||||
hh->printf("\t\t\t<status>%s</status>\n",(timer->standby_on)? "on" : "off");
|
hh->printf("\t\t\t<status>%s</status>\n",(timer->standby_on)? "on" : "off");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CTimerd::TIMER_REMIND :{
|
case CTimerd::TIMER_REMIND : {
|
||||||
std::string _message;
|
std::string _message;
|
||||||
_message = std::string(timer->message).substr(0,20);
|
_message = std::string(timer->message).substr(0,20);
|
||||||
hh->printf("\t\t\t<message>%s</message>\n",_message.c_str());
|
hh->printf("\t\t\t<message>%s</message>\n",_message.c_str());
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CTimerd::TIMER_EXEC_PLUGIN :{
|
case CTimerd::TIMER_EXEC_PLUGIN : {
|
||||||
hh->printf("\t\t\t<plugin>%s</plugin>\n",timer->pluginName);
|
hh->printf("\t\t\t<plugin>%s</plugin>\n",timer->pluginName);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CTimerd::TIMER_SLEEPTIMER :{
|
case CTimerd::TIMER_SLEEPTIMER : {
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CTimerd::TIMER_IMMEDIATE_RECORD :{
|
case CTimerd::TIMER_IMMEDIATE_RECORD : {
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:{}
|
default:
|
||||||
|
{}
|
||||||
}
|
}
|
||||||
hh->WriteLn("\t\t</timer>\n");
|
hh->WriteLn("\t\t</timer>\n");
|
||||||
}
|
}
|
||||||
@@ -1862,7 +1901,7 @@ std::string CControlAPI::YexecuteScript(CyhookHandler *, std::string cmd)
|
|||||||
char cwd[255];
|
char cwd[255];
|
||||||
getcwd(cwd, 254);
|
getcwd(cwd, 254);
|
||||||
|
|
||||||
for (unsigned int i=0;i<PLUGIN_DIR_COUNT && !found;i++)
|
for (unsigned int i=0; i<PLUGIN_DIR_COUNT && !found; i++)
|
||||||
{
|
{
|
||||||
fullfilename = PLUGIN_DIRS[i]+"/"+script;
|
fullfilename = PLUGIN_DIRS[i]+"/"+script;
|
||||||
FILE *test =fopen(fullfilename.c_str(),"r"); // use fopen: popen does not work
|
FILE *test =fopen(fullfilename.c_str(),"r"); // use fopen: popen does not work
|
||||||
@@ -1887,7 +1926,7 @@ std::string CControlAPI::YexecuteScript(CyhookHandler *, std::string cmd)
|
|||||||
if (!found)
|
if (!found)
|
||||||
{
|
{
|
||||||
printf("[CControlAPI] script %s not found in\n",script.c_str());
|
printf("[CControlAPI] script %s not found in\n",script.c_str());
|
||||||
for (unsigned int i=0;i<PLUGIN_DIR_COUNT;i++) {
|
for (unsigned int i=0; i<PLUGIN_DIR_COUNT; i++) {
|
||||||
printf("%s\n",PLUGIN_DIRS[i].c_str());
|
printf("%s\n",PLUGIN_DIRS[i].c_str());
|
||||||
}
|
}
|
||||||
result="error";
|
result="error";
|
||||||
@@ -2117,7 +2156,7 @@ void CControlAPI::doNewTimer(CyhookHandler *hh)
|
|||||||
real_alarmTimeT -= pre;
|
real_alarmTimeT -= pre;
|
||||||
}
|
}
|
||||||
|
|
||||||
for(; timer != timerlist.end();timer++)
|
for(; timer != timerlist.end(); timer++)
|
||||||
if(timer->alarmTime == real_alarmTimeT)
|
if(timer->alarmTime == real_alarmTimeT)
|
||||||
{
|
{
|
||||||
NeutrinoAPI->Timerd->removeTimerEvent(timer->eventID);
|
NeutrinoAPI->Timerd->removeTimerEvent(timer->eventID);
|
||||||
@@ -2227,7 +2266,7 @@ void CControlAPI::changeBouquetCGI(CyhookHandler *hh)
|
|||||||
CZapitClient::BouquetChannelList BChannelList;
|
CZapitClient::BouquetChannelList BChannelList;
|
||||||
NeutrinoAPI->Zapit->getBouquetChannels(selected - 1, BChannelList, CZapitClient::MODE_CURRENT, true);
|
NeutrinoAPI->Zapit->getBouquetChannels(selected - 1, BChannelList, CZapitClient::MODE_CURRENT, true);
|
||||||
CZapitClient::BouquetChannelList::iterator channels = BChannelList.begin();
|
CZapitClient::BouquetChannelList::iterator channels = BChannelList.begin();
|
||||||
for(; channels != BChannelList.end();channels++)
|
for(; channels != BChannelList.end(); channels++)
|
||||||
{
|
{
|
||||||
NeutrinoAPI->Zapit->removeChannelFromBouquet(selected - 1, channels->channel_id);
|
NeutrinoAPI->Zapit->removeChannelFromBouquet(selected - 1, channels->channel_id);
|
||||||
}
|
}
|
||||||
@@ -2351,30 +2390,30 @@ void CControlAPI::ConfigCGI(CyhookHandler *hh)
|
|||||||
else if(hh->ParamList["config"] == "yweb")
|
else if(hh->ParamList["config"] == "yweb")
|
||||||
config_filename = YWEB_CONFIGFILE;
|
config_filename = YWEB_CONFIGFILE;
|
||||||
|
|
||||||
if(config_filename != ""){
|
if(config_filename != "") {
|
||||||
Config->loadConfig(config_filename);
|
Config->loadConfig(config_filename);
|
||||||
|
|
||||||
if(load){
|
if(load) {
|
||||||
conf = Config->getConfigDataMap();
|
conf = Config->getConfigDataMap();
|
||||||
ConfigDataMap::iterator it;
|
ConfigDataMap::iterator it;
|
||||||
for(it = conf.begin(); it != conf.end(); it++){
|
for(it = conf.begin(); it != conf.end(); it++) {
|
||||||
std::string key =it->first;
|
std::string key =it->first;
|
||||||
replace(key,".","_dot_");
|
replace(key,".","_dot_");
|
||||||
replace(key,"-","_bind_");
|
replace(key,"-","_bind_");
|
||||||
if(!(hh->ParamList["config"] == "nhttpd" && it->first == "mod_auth.password")){
|
if(!(hh->ParamList["config"] == "nhttpd" && it->first == "mod_auth.password")) {
|
||||||
// Output as json (default)
|
// Output as json (default)
|
||||||
if (hh->ParamList["format"] == "json" || hh->ParamList["format"] == ""){
|
if (hh->ParamList["format"] == "json" || hh->ParamList["format"] == "") {
|
||||||
result += string_printf("%s: '%s',\n", (key).c_str(), (it->second).c_str());
|
result += string_printf("%s: '%s',\n", (key).c_str(), (it->second).c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (CStringList::iterator it = hh->ParamList.begin(); it
|
for (CStringList::iterator it = hh->ParamList.begin(); it
|
||||||
!= hh->ParamList.end(); it++){
|
!= hh->ParamList.end(); it++) {
|
||||||
std::string key = it->first;
|
std::string key = it->first;
|
||||||
replace(key,"_dot_",".");
|
replace(key,"_dot_",".");
|
||||||
replace(key,"_bind_","-");
|
replace(key,"_bind_","-");
|
||||||
if(key != "_dc" && key != "action" && key != "format" && key != "config"){
|
if(key != "_dc" && key != "action" && key != "format" && key != "config") {
|
||||||
Config->setString(key, it->second);
|
Config->setString(key, it->second);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2385,14 +2424,14 @@ void CControlAPI::ConfigCGI(CyhookHandler *hh)
|
|||||||
else
|
else
|
||||||
error = string_printf("no config defined for: %s", (hh->ParamList["config"]).c_str() );
|
error = string_printf("no config defined for: %s", (hh->ParamList["config"]).c_str() );
|
||||||
|
|
||||||
if(error == ""){
|
if(error == "") {
|
||||||
if (hh->ParamList["format"] == "json" || hh->ParamList["format"] == ""){
|
if (hh->ParamList["format"] == "json" || hh->ParamList["format"] == "") {
|
||||||
hh->WriteLn("{success: 'true', data:{");
|
hh->WriteLn("{success: 'true', data:{");
|
||||||
hh->WriteLn(result);
|
hh->WriteLn(result);
|
||||||
hh->WriteLn("}}");
|
hh->WriteLn("}}");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (hh->ParamList["format"] == "json" || hh->ParamList["format"] == ""){
|
if (hh->ParamList["format"] == "json" || hh->ParamList["format"] == "") {
|
||||||
hh->WriteLn("{success: 'false', error:{");
|
hh->WriteLn("{success: 'false', error:{");
|
||||||
hh->WriteLn(error);
|
hh->WriteLn(error);
|
||||||
hh->WriteLn("}}");
|
hh->WriteLn("}}");
|
||||||
@@ -2411,7 +2450,7 @@ void CControlAPI::FileCGI(CyhookHandler *hh)
|
|||||||
{
|
{
|
||||||
|
|
||||||
// directory list: action=list&path=<path>
|
// directory list: action=list&path=<path>
|
||||||
if (hh->ParamList["action"] == "list"){
|
if (hh->ParamList["action"] == "list") {
|
||||||
DIR *dirp;
|
DIR *dirp;
|
||||||
struct dirent *entry;
|
struct dirent *entry;
|
||||||
struct stat statbuf;
|
struct stat statbuf;
|
||||||
@@ -2425,7 +2464,7 @@ void CControlAPI::FileCGI(CyhookHandler *hh)
|
|||||||
std::string path = hh->ParamList["path"];
|
std::string path = hh->ParamList["path"];
|
||||||
if((dirp = opendir( path.c_str() )))
|
if((dirp = opendir( path.c_str() )))
|
||||||
{
|
{
|
||||||
while((entry = readdir(dirp))){
|
while((entry = readdir(dirp))) {
|
||||||
hh->WriteLn("\t<item>");
|
hh->WriteLn("\t<item>");
|
||||||
hh->printf("\t\t<name>%s</name>\n", entry->d_name);
|
hh->printf("\t\t<name>%s</name>\n", entry->d_name);
|
||||||
std::string ftype;
|
std::string ftype;
|
||||||
@@ -2443,7 +2482,7 @@ void CControlAPI::FileCGI(CyhookHandler *hh)
|
|||||||
std::string fullname = path + entry->d_name;
|
std::string fullname = path + entry->d_name;
|
||||||
hh->printf("\t\t<fullname>%s</fullname>", fullname.c_str());
|
hh->printf("\t\t<fullname>%s</fullname>", fullname.c_str());
|
||||||
//entry->d_name
|
//entry->d_name
|
||||||
if(stat(fullname.c_str(), &statbuf)!=-1){
|
if(stat(fullname.c_str(), &statbuf)!=-1) {
|
||||||
hh->printf("\t\t<mode>%xld</mode>", (long)statbuf.st_mode);
|
hh->printf("\t\t<mode>%xld</mode>", (long)statbuf.st_mode);
|
||||||
/* Print out type, permissions, and number of links. */
|
/* Print out type, permissions, and number of links. */
|
||||||
// hh->printf("\t\t<permission>%10.10s</permission>\n", sperm (statbuf.st_mode));
|
// hh->printf("\t\t<permission>%10.10s</permission>\n", sperm (statbuf.st_mode));
|
||||||
@@ -2473,11 +2512,11 @@ void CControlAPI::FileCGI(CyhookHandler *hh)
|
|||||||
hh->WriteLn("</filelist>");
|
hh->WriteLn("</filelist>");
|
||||||
}
|
}
|
||||||
// create new folder
|
// create new folder
|
||||||
else if (hh->ParamList["action"] == "new_folder"){
|
else if (hh->ParamList["action"] == "new_folder") {
|
||||||
hh->SetHeader(HTTP_OK, "text/plain; charset=UTF-8");
|
hh->SetHeader(HTTP_OK, "text/plain; charset=UTF-8");
|
||||||
//TODO
|
//TODO
|
||||||
}
|
}
|
||||||
else if (hh->ParamList["action"] == "delete"){
|
else if (hh->ParamList["action"] == "delete") {
|
||||||
hh->SetHeader(HTTP_OK, "text/plain; charset=UTF-8");
|
hh->SetHeader(HTTP_OK, "text/plain; charset=UTF-8");
|
||||||
//TODO
|
//TODO
|
||||||
}
|
}
|
||||||
|
@@ -70,6 +70,7 @@ private:
|
|||||||
void GetChannel_IDCGI(CyhookHandler *hh);
|
void GetChannel_IDCGI(CyhookHandler *hh);
|
||||||
void MessageCGI(CyhookHandler *hh);
|
void MessageCGI(CyhookHandler *hh);
|
||||||
void InfoCGI(CyhookHandler *hh);
|
void InfoCGI(CyhookHandler *hh);
|
||||||
|
void HWInfoCGI(CyhookHandler *hh);
|
||||||
void ShutdownCGI(CyhookHandler *hh);
|
void ShutdownCGI(CyhookHandler *hh);
|
||||||
void VolumeCGI(CyhookHandler *hh);
|
void VolumeCGI(CyhookHandler *hh);
|
||||||
void ChannellistCGI(CyhookHandler *hh);
|
void ChannellistCGI(CyhookHandler *hh);
|
||||||
|
Reference in New Issue
Block a user