mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-26 23:13:13 +02:00
nhttpd/controlapi: add mode=all to GetBouquetCGI
This commit is contained in:
@@ -939,14 +939,14 @@ void CControlAPI::GetBouquetCGI(CyhookHandler *hh) {
|
|||||||
|
|
||||||
std::string result = "";
|
std::string result = "";
|
||||||
if (!(hh->ParamList.empty())) {
|
if (!(hh->ParamList.empty())) {
|
||||||
int mode = CZapitClient::MODE_CURRENT;
|
int mode = NeutrinoAPI->Zapit->getMode();
|
||||||
|
|
||||||
if (!(hh->ParamList["mode"].empty())) {
|
if (hh->ParamList["mode"].compare("TV") == 0)
|
||||||
if (hh->ParamList["mode"].compare("TV") == 0)
|
mode = CZapitClient::MODE_TV;
|
||||||
mode = CZapitClient::MODE_TV;
|
else if (hh->ParamList["mode"].compare("RADIO") == 0)
|
||||||
if (hh->ParamList["mode"].compare("RADIO") == 0)
|
mode = CZapitClient::MODE_RADIO;
|
||||||
mode = CZapitClient::MODE_RADIO;
|
else if (hh->ParamList["mode"].compare("all") == 0)
|
||||||
}
|
mode = CZapitClient::MODE_ALL;
|
||||||
|
|
||||||
// Get Bouquet Number. First matching current channel
|
// Get Bouquet Number. First matching current channel
|
||||||
if (hh->ParamList["1"] == "actual") {
|
if (hh->ParamList["1"] == "actual") {
|
||||||
@@ -960,7 +960,6 @@ void CControlAPI::GetBouquetCGI(CyhookHandler *hh) {
|
|||||||
hh->printf("%d", actual);
|
hh->printf("%d", actual);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
ZapitChannelList channels;
|
|
||||||
int BouquetNr = -1; // -1 = all bouquets
|
int BouquetNr = -1; // -1 = all bouquets
|
||||||
int startBouquet = 0;
|
int startBouquet = 0;
|
||||||
int bsize = (int) g_bouquetManager->Bouquets.size();
|
int bsize = (int) g_bouquetManager->Bouquets.size();
|
||||||
@@ -977,22 +976,31 @@ void CControlAPI::GetBouquetCGI(CyhookHandler *hh) {
|
|||||||
}
|
}
|
||||||
if (!(hh->ParamList["epg"].empty()))
|
if (!(hh->ParamList["epg"].empty()))
|
||||||
NeutrinoAPI->GetChannelEvents();
|
NeutrinoAPI->GetChannelEvents();
|
||||||
for (int i = startBouquet; i < bsize; i++) {
|
const char *json_delimiter = "";
|
||||||
channels = mode == CZapitClient::MODE_RADIO ? g_bouquetManager->Bouquets[i]->radioChannels : g_bouquetManager->Bouquets[i]->tvChannels;
|
if (mode == CZapitClient::MODE_RADIO || mode == CZapitClient::MODE_ALL)
|
||||||
int num = 1 + (mode == CZapitClient::MODE_RADIO ? g_bouquetManager->radioChannelsBegin().getNrofFirstChannelofBouquet(i)
|
for (int i = startBouquet; i < bsize; i++) {
|
||||||
: g_bouquetManager->tvChannelsBegin().getNrofFirstChannelofBouquet(i));
|
ZapitChannelList channels = g_bouquetManager->Bouquets[i]->radioChannels;
|
||||||
int size = (int) channels.size();
|
int num = 1 + g_bouquetManager->radioChannelsBegin().getNrofFirstChannelofBouquet(i);
|
||||||
for (int j = 0; j < size; j++) {
|
int size = (int) channels.size();
|
||||||
CZapitChannel * channel = channels[j];
|
for (int j = 0; j < size; j++) {
|
||||||
result += _GetBouquetWriteItem(hh, channel, i, num + j);
|
CZapitChannel * channel = channels[j];
|
||||||
if (j < (size - 1) && outType == json) {
|
result += json_delimiter;
|
||||||
result += ",\n";
|
json_delimiter = (outType == json) ? ",\n" : "";
|
||||||
|
result += _GetBouquetWriteItem(hh, channel, i, num + j);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (i < (bsize - 1) && outType == json && size > 0) {
|
if (mode == CZapitClient::MODE_TV || mode == CZapitClient::MODE_ALL)
|
||||||
result += ",\n";
|
for (int i = startBouquet; i < bsize; i++) {
|
||||||
|
ZapitChannelList channels = g_bouquetManager->Bouquets[i]->tvChannels;
|
||||||
|
int num = 1 + g_bouquetManager->tvChannelsBegin().getNrofFirstChannelofBouquet(i);
|
||||||
|
int size = (int) channels.size();
|
||||||
|
for (int j = 0; j < size; j++) {
|
||||||
|
CZapitChannel * channel = channels[j];
|
||||||
|
result += json_delimiter;
|
||||||
|
json_delimiter = (outType == json) ? ",\n" : "";
|
||||||
|
result += _GetBouquetWriteItem(hh, channel, i, num + j);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
result = hh->outArray("channels", result);
|
result = hh->outArray("channels", result);
|
||||||
// write footer
|
// write footer
|
||||||
if (outType == json) {
|
if (outType == json) {
|
||||||
|
Reference in New Issue
Block a user