controlapi: reformat CControlAPI::xmltvm3uCGI() function; no other changes

Origin commit data
------------------
Branch: ni/coolstream
Commit: a68703b238
Author: vanhofen <vanhofen@gmx.de>
Date: 2018-09-09 (Sun, 09 Sep 2018)

Origin message was:
------------------
- controlapi: reformat CControlAPI::xmltvm3uCGI() function; no other changes

------------------
No further description and justification available within origin commit message!

------------------
This commit was generated by Migit
This commit is contained in:
vanhofen
2018-09-09 13:26:51 +02:00
parent 357b10d40b
commit d62bd2dc5b

View File

@@ -3306,47 +3306,47 @@ void CControlAPI::xmltvepgCGI(CyhookHandler *hh)
void CControlAPI::xmltvm3uCGI(CyhookHandler *hh) void CControlAPI::xmltvm3uCGI(CyhookHandler *hh)
{ {
hh->outStart(); hh->outStart();
std::string result = ""; std::string result = "";
int mode = NeutrinoAPI->Zapit->getMode(); int mode = NeutrinoAPI->Zapit->getMode();
// build url // build url
std::string url = ""; std::string url = "";
if(!hh->ParamList["host"].empty()) if (!hh->ParamList["host"].empty())
url = "http://"+hh->ParamList["host"]; url = "http://" + hh->ParamList["host"];
else else
url = "http://"+hh->HeaderList["Host"]; url = "http://" + hh->HeaderList["Host"];
std::string lurl = url; std::string lurl = url;
/* strip off optional custom port */ /* strip off optional custom port */
if (url.rfind(":") != 4) if (url.rfind(":") != 4)
url = url.substr(0, url.rfind(":")); url = url.substr(0, url.rfind(":"));
url += ":31339/id="; url += ":31339/id=";
result += "#EXTM3U\n"; result += "#EXTM3U\n";
for (int i = 0; i < (int) g_bouquetManager->Bouquets.size(); i++) for (int i = 0; i < (int) g_bouquetManager->Bouquets.size(); i++)
{ {
ZapitChannelList chanlist; ZapitChannelList chanlist;
if (mode == CZapitClient::MODE_RADIO) if (mode == CZapitClient::MODE_RADIO)
g_bouquetManager->Bouquets[i]->getRadioChannels(chanlist); g_bouquetManager->Bouquets[i]->getRadioChannels(chanlist);
else else
g_bouquetManager->Bouquets[i]->getTvChannels(chanlist); g_bouquetManager->Bouquets[i]->getTvChannels(chanlist);
if(!chanlist.empty() && !g_bouquetManager->Bouquets[i]->bHidden && g_bouquetManager->Bouquets[i]->bUser) if (!chanlist.empty() && !g_bouquetManager->Bouquets[i]->bHidden && g_bouquetManager->Bouquets[i]->bUser)
{ {
for(int j = 0; j < (int) chanlist.size(); j++) for (int j = 0; j < (int) chanlist.size(); j++)
{ {
CZapitChannel * channel = chanlist[j]; CZapitChannel *channel = chanlist[j];
std::string bouq_name = g_bouquetManager->Bouquets[i]->bName; std::string bouq_name = g_bouquetManager->Bouquets[i]->bName;
std::string chan_id_short = string_printf(PRINTF_CHANNEL_ID_TYPE_NO_LEADING_ZEROS, channel->getChannelID() & 0xFFFFFFFFFFFFULL); std::string chan_id_short = string_printf(PRINTF_CHANNEL_ID_TYPE_NO_LEADING_ZEROS, channel->getChannelID() & 0xFFFFFFFFFFFFULL);
result += "#EXTINF:-1 tvg-id=\""+chan_id_short+"\" tvg-logo=\""+lurl+NeutrinoAPI->getLogoFile(channel->getChannelID())+"\" group-title=\""+bouq_name+"\","+channel->getName()+"\n"; result += "#EXTINF:-1 tvg-id=\"" + chan_id_short + "\" tvg-logo=\"" + lurl + NeutrinoAPI->getLogoFile(channel->getChannelID()) + "\" group-title=\"" + bouq_name + "\"," + channel->getName() + "\n";
result += url+string_printf(PRINTF_CHANNEL_ID_TYPE_NO_LEADING_ZEROS, channel->getChannelID())+"\n"; result += url + string_printf(PRINTF_CHANNEL_ID_TYPE_NO_LEADING_ZEROS, channel->getChannelID()) + "\n";
} }
} }
} }
hh->SendResult(result); hh->SendResult(result);
} }
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
// audio_no : (optional) audio channel // audio_no : (optional) audio channel