nhttpd/tuxboxapi/coolstream/controlapi.cpp: call GetChannelEvents only if epg param present,

add 'fav' param to get only user bouquets;
add support to get bouquet's channel list with epg also in plain format
This commit is contained in:
[CST] Focus
2013-09-03 12:12:36 +04:00
parent a876b074ed
commit 2df40249d6

View File

@@ -960,12 +960,24 @@ std::string CControlAPI::_GetBouquetWriteItem(CyhookHandler *hh, CZapitChannel *
result = hh->outArrayItem("channel", result, false);
}
else {
result += string_printf("%u "
PRINTF_CHANNEL_ID_TYPE_NO_LEADING_ZEROS
" %s\n",
nr,
channel->channel_id,
channel->getName().c_str());
CChannelEvent *event;
event = NeutrinoAPI->ChannelListEvents[channel->channel_id];
if (event && isEPGdetails) {
result += string_printf("%u "
PRINTF_CHANNEL_ID_TYPE_NO_LEADING_ZEROS
" %s (%s)\n",
nr,
channel->channel_id,
channel->getName().c_str(), event->description.c_str());
} else {
result += string_printf("%u "
PRINTF_CHANNEL_ID_TYPE_NO_LEADING_ZEROS
" %s\n",
nr,
channel->channel_id,
channel->getName().c_str());
}
}
return result;
}
@@ -1073,7 +1085,8 @@ void CControlAPI::GetBouquetCGI(CyhookHandler *hh) {
startBouquet = BouquetNr;
bsize = BouquetNr+1;
}
NeutrinoAPI->GetChannelEvents();
if (!(hh->ParamList["epg"].empty()))
NeutrinoAPI->GetChannelEvents();
for (int i = startBouquet; i < bsize; i++) {
channels = mode == CZapitClient::MODE_RADIO ? g_bouquetManager->Bouquets[i]->radioChannels : g_bouquetManager->Bouquets[i]->tvChannels;
int num = 1 + (mode == CZapitClient::MODE_RADIO ? g_bouquetManager->radioChannelsBegin().getNrofFirstChannelofBouquet(i)
@@ -1185,12 +1198,16 @@ void CControlAPI::GetBouquetsCGI(CyhookHandler *hh) {
if (hh->ParamList["encode"] == "true")
encode = true;
bool fav = false;
if (hh->ParamList["fav"] == "true")
fav = true;
int mode = NeutrinoAPI->Zapit->getMode();
std::string bouquet;
for (int i = 0, size = (int) g_bouquetManager->Bouquets.size(); i < size; i++) {
std::string item = "";
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) && (!fav || g_bouquetManager->Bouquets[i]->bUser)) {
bouquet = std::string(g_bouquetManager->Bouquets[i]->bFav ? g_Locale->getText(LOCALE_FAVORITES_BOUQUETNAME) : g_bouquetManager->Bouquets[i]->Name.c_str());
if (encode)
bouquet = encodeString(bouquet); // encode (URLencode) the bouquetname