merge public git changes

This commit is contained in:
[CST] Focus
2013-01-09 19:30:07 +04:00
57 changed files with 804 additions and 227 deletions

View File

@@ -163,6 +163,7 @@ const CControlAPI::TyCgiCall CControlAPI::yCgiCallList[]=
{"epg", &CControlAPI::EpgCGI, ""},
{"zapto", &CControlAPI::ZaptoCGI, "text/plain"},
{"getonidsid", &CControlAPI::GetChannel_IDCGI, "text/plain"},
{"currenttpchannels", &CControlAPI::GetTPChannel_IDCGI, "text/plain"},
// boxcontrol - system
{"standby", &CControlAPI::StandbyCGI, "text/plain"},
{"shutdown", &CControlAPI::ShutdownCGI, "text/plain"},
@@ -531,6 +532,12 @@ void CControlAPI::GetChannel_IDCGI(CyhookHandler *hh)
hh->printf("%x%04x%04x\n",current_pids.tsid, current_pids.onid, current_pids.sid);
}
// get actual channel_id
void CControlAPI::GetTPChannel_IDCGI(CyhookHandler *hh)
{
SendChannelList(hh, true);
}
//-----------------------------------------------------------------------------
void CControlAPI::MessageCGI(CyhookHandler *hh)
{
@@ -561,7 +568,7 @@ void CControlAPI::MessageCGI(CyhookHandler *hh)
if (event != 0)
{
message=decodeString(message);
//message=decodeString(message);
NeutrinoAPI->EventServer->sendEvent(event, CEventServer::INITID_HTTPD, (void *) message.c_str(), message.length() + 1);
hh->SendOk();
}
@@ -1562,7 +1569,7 @@ void CControlAPI::StartPluginCGI(CyhookHandler *hh)
if (hh->ParamList["name"] != "")
{
pluginname = hh->ParamList["name"];
pluginname=decodeString(pluginname);
//pluginname=decodeString(pluginname);
NeutrinoAPI->EventServer->sendEvent(NeutrinoMessages::EVT_START_PLUGIN,
CEventServer::INITID_HTTPD,
(void *) pluginname.c_str(),
@@ -1597,17 +1604,22 @@ void CControlAPI::SendEventList(CyhookHandler *hh, t_channel_id channel_id)
}
//-----------------------------------------------------------------------------
void CControlAPI::SendChannelList(CyhookHandler *hh)
void CControlAPI::SendChannelList(CyhookHandler *hh, bool currentTP)
{
t_channel_id current_channel = 0;
if(currentTP){
current_channel = CZapit::getInstance()->GetCurrentChannelID();
current_channel=(current_channel>>16);
}
int mode = NeutrinoAPI->Zapit->getMode();
hh->SetHeader(HTTP_OK, "text/plain; charset=UTF-8");
CBouquetManager::ChannelIterator cit = mode == CZapitClient::MODE_RADIO ? g_bouquetManager->radioChannelsBegin() : g_bouquetManager->tvChannelsBegin();
for (; !(cit.EndOfChannels()); cit++) {
CZapitChannel * channel = *cit;
hh->printf(PRINTF_CHANNEL_ID_TYPE_NO_LEADING_ZEROS
" %s\n",
channel->channel_id,
channel->getName().c_str());
if(!currentTP || (channel->channel_id >>16) == current_channel){
hh->printf(PRINTF_CHANNEL_ID_TYPE_NO_LEADING_ZEROS " %s\n", channel->channel_id, channel->getName().c_str());
}
}
}
@@ -2119,6 +2131,7 @@ void CControlAPI::doNewTimer(CyhookHandler *hh)
alarmTimeT = 0,
tnull = 0;
unsigned int repCount = 0;
int alHour=0;
// if alarm given then in parameters im time_t format
if(hh->ParamList["alarm"] != "")
@@ -2137,13 +2150,16 @@ void CControlAPI::doNewTimer(CyhookHandler *hh)
tnull = time(NULL);
struct tm *alarmTime=localtime(&tnull);
alarmTime->tm_sec = 0;
strptime(hh->ParamList["alDate"].c_str(), "%d.%m.%Y", alarmTime);
if(sscanf(hh->ParamList["alDate"].c_str(),"%2d.%2d.%4d",&(alarmTime->tm_mday), &(alarmTime->tm_mon), &(alarmTime->tm_year)) == 3)
{
alarmTime->tm_mon -= 1;
alarmTime->tm_year -= 1900;
}
// Alarm Time - Format exact! HH:MM
if(hh->ParamList["alTime"] != "")
strptime(hh->ParamList["alTime"].c_str(), "%H:%M", alarmTime);
int alHour = alarmTime->tm_hour;
sscanf(hh->ParamList["alTime"].c_str(),"%2d.%2d",&(alarmTime->tm_hour), &(alarmTime->tm_min));
alHour = alarmTime->tm_hour;
correctTime(alarmTime);
alarmTimeT = mktime(alarmTime);
announceTimeT = alarmTimeT;
@@ -2151,12 +2167,15 @@ void CControlAPI::doNewTimer(CyhookHandler *hh)
stopTime->tm_sec = 0;
// Stop Time - Format exact! HH:MM
if(hh->ParamList["stTime"] != "")
strptime(hh->ParamList["stTime"].c_str(), "%H:%M", stopTime);
sscanf(hh->ParamList["stTime"].c_str(),"%2d.%2d",&(stopTime->tm_hour), &(stopTime->tm_min));
// Stop Date - Format exact! DD.MM.YYYY
if(hh->ParamList["stDate"] != "")
strptime(hh->ParamList["stDate"].c_str(), "%d.%m.%Y", stopTime);
stopTime->tm_sec = 0;
if(sscanf(hh->ParamList["stDate"].c_str(),"%2d.%2d.%4d",&(stopTime->tm_mday), &(stopTime->tm_mon), &(stopTime->tm_year)) == 3)
{
stopTime->tm_mon -= 1;
stopTime->tm_year -= 1900;
}
correctTime(stopTime);
stopTimeT = mktime(stopTime);
if(hh->ParamList["stDate"] == "" && alHour > stopTime->tm_hour)
@@ -2218,9 +2237,9 @@ void CControlAPI::doNewTimer(CyhookHandler *hh)
rep = (CTimerd::CTimerEventRepeat) atoi(hh->ParamList["rep"].c_str());
else // default: no repeat
rep = (CTimerd::CTimerEventRepeat)0;
if(((int)rep) >= ((int)CTimerd::TIMERREPEAT_WEEKDAYS) && hh->ParamList["wd"] != "")
NeutrinoAPI->Timerd->getWeekdaysFromStr(&rep, hh->ParamList["wd"].c_str());
// apids
bool changeApids=false;
unsigned char apids=0;
@@ -2247,6 +2266,7 @@ void CControlAPI::doNewTimer(CyhookHandler *hh)
apids |= TIMERD_APIDS_AC3;
}
}
CTimerd::RecordingInfo recinfo;
CTimerd::EventInfo eventinfo;
eventinfo.epgID = 0;
@@ -2257,8 +2277,8 @@ void CControlAPI::doNewTimer(CyhookHandler *hh)
// channel by Id or name
if(hh->ParamList["channel_id"] != "")
sscanf(hh->ParamList["channel_id"].c_str(),
SCANF_CHANNEL_ID_TYPE,
&eventinfo.channel_id);
SCANF_CHANNEL_ID_TYPE,
&eventinfo.channel_id);
else
eventinfo.channel_id = NeutrinoAPI->ChannelNameToChannelId(hh->ParamList["channel_name"]);
@@ -2281,7 +2301,7 @@ void CControlAPI::doNewTimer(CyhookHandler *hh)
CConfigFile *Config = new CConfigFile(',');
Config->loadConfig(NEUTRINO_CONFIGFILE);
_rec_dir = Config->getString("network_nfs_recordingdir", "/mnt/filme");
delete Config;//Memory leak: Config
delete Config;
}
if(changeApids)
eventinfo.apids = apids;
@@ -2309,7 +2329,13 @@ void CControlAPI::doNewTimer(CyhookHandler *hh)
if(hh->ParamList["id"] != "")
{
unsigned modyId = atoi(hh->ParamList["id"].c_str());
NeutrinoAPI->Timerd->removeTimerEvent(modyId);
if(type == CTimerd::TIMER_RECORD)
NeutrinoAPI->Timerd->modifyRecordTimerEvent(modyId, announceTimeT, alarmTimeT, stopTimeT, rep,repCount,_rec_dir.c_str());
else
NeutrinoAPI->Timerd->modifyTimerEvent(modyId, announceTimeT, alarmTimeT, stopTimeT, rep,repCount);
// NeutrinoAPI->Timerd->removeTimerEvent(modyId);
if(changeApids)
NeutrinoAPI->Timerd->modifyTimerAPid(modyId,apids);
}
else
{
@@ -2327,15 +2353,18 @@ void CControlAPI::doNewTimer(CyhookHandler *hh)
real_alarmTimeT -= pre;
}
for(; timer != timerlist.end(); ++timer)
for(; timer != timerlist.end();++timer)
if(timer->alarmTime == real_alarmTimeT)
{
NeutrinoAPI->Timerd->removeTimerEvent(timer->eventID);
break;
}
NeutrinoAPI->Timerd->addTimerEvent(type,data,announceTimeT,alarmTimeT,stopTimeT,rep,repCount);
}
}
NeutrinoAPI->Timerd->addTimerEvent(type,data,announceTimeT,alarmTimeT,stopTimeT,rep,repCount);
else
NeutrinoAPI->Timerd->addTimerEvent(type,data,announceTimeT,alarmTimeT,stopTimeT,rep,repCount);
hh->SendOk();
}
//-------------------------------------------------------------------------

View File

@@ -36,7 +36,7 @@ private:
void SendStreamInfo(CyhookHandler *hh);
void SendBouquets(CyhookHandler *hh);
void SendBouquet(CyhookHandler *hh,int BouquetNr);
void SendChannelList(CyhookHandler *hh);
void SendChannelList(CyhookHandler *hh, bool currentTP = false);
void SendTimers(CyhookHandler *hh);
void SendTimersXML(CyhookHandler *hh);
void epgDetailList(CyhookHandler *hh);
@@ -70,6 +70,7 @@ private:
void GetServicesxmlCGI(CyhookHandler *hh);
void GetBouquetsxmlCGI(CyhookHandler *hh);
void GetChannel_IDCGI(CyhookHandler *hh);
void GetTPChannel_IDCGI(CyhookHandler *hh);
void MessageCGI(CyhookHandler *hh);
void InfoCGI(CyhookHandler *hh);
void HWInfoCGI(CyhookHandler *hh);

View File

@@ -223,7 +223,7 @@ std::string CNeutrinoYParser::func_get_bouquets_as_dropdown(CyhookHandler *, st
sel=(nr==(i+1)) ? "selected=\"selected\"" : "";
if(!channels->empty() && (!g_bouquetManager->Bouquets[i]->bHidden || do_show_hidden == "true"))
yresult += string_printf("<option value=%u %s>%s</option>\n", i + 1, sel.c_str(),
(encodeString(std::string(g_bouquetManager->Bouquets[i]->bFav ? g_Locale->getText(LOCALE_FAVORITES_BOUQUETNAME) :g_bouquetManager->Bouquets[i]->Name.c_str()))).c_str());
std::string(g_bouquetManager->Bouquets[i]->bFav ? g_Locale->getText(LOCALE_FAVORITES_BOUQUETNAME) :g_bouquetManager->Bouquets[i]->Name.c_str()).c_str());
//yresult += string_printf("<option value=%u %s>%s</option>\n", i + 1, sel.c_str(), (encodeString(std::string(g_bouquetManager->Bouquets[i]->Name.c_str()))).c_str());
}
return yresult;
@@ -557,7 +557,7 @@ std::string CNeutrinoYParser::func_get_audio_pids_as_dropdown(CyhookHandler *,
{
if(!(isalnum(tags[i].component[0])))
tags[i].component=tags[i].component.substr(1,tags[i].component.length()-1);
yresult += string_printf("<option value=%05u>%s</option>\r\n",idx_as_id ? j : pids.APIDs[j].pid,encodeString(tags[i].component).c_str());
yresult += string_printf("<option value=%05u>%s</option>\r\n",idx_as_id ? j : pids.APIDs[j].pid,tags[i].component.c_str());
}
else
{
@@ -565,7 +565,7 @@ std::string CNeutrinoYParser::func_get_audio_pids_as_dropdown(CyhookHandler *,
{
strcpy( pids.APIDs[j].desc, _getISO639Description( pids.APIDs[j].desc ) );
}
yresult += string_printf("<option value=%05u>%s %s</option>\r\n",idx_as_id ? j : pids.APIDs[j].pid,encodeString(std::string(pids.APIDs[j].desc)).c_str(),pids.APIDs[j].is_ac3 ? " (AC3)": " ");
yresult += string_printf("<option value=%05u>%s %s</option>\r\n",idx_as_id ? j : pids.APIDs[j].pid,std::string(pids.APIDs[j].desc).c_str(),pids.APIDs[j].is_ac3 ? " (AC3)": " ");
}
eit_not_ok=false;
break;