src/nhttpd/tuxboxapi/coolstream/controlapi.cpp: add current transponder pchannels list , use: <BOXID>/control/currenttpchannels

This commit is contained in:
satbaby
2012-12-23 19:12:41 +01:00
parent b58cbd4135
commit 4965619a79
2 changed files with 19 additions and 6 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)
{
@@ -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());
}
}
}

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);