add support for embedded epg-url in m3u

Origin commit data
------------------
Branch: ni/coolstream
Commit: 8a3dc3a6c4
Author: TangoCash <eric@loxat.de>
Date: 2021-09-09 (Thu, 09 Sep 2021)


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

------------------
This commit was generated by Migit
This commit is contained in:
TangoCash
2021-09-09 18:27:57 +02:00
committed by vanhofen
parent e2b73d2b9b
commit eece9dbc66
6 changed files with 60 additions and 7 deletions

View File

@@ -3252,6 +3252,14 @@ void CControlAPI::xmltvepgCGI(CyhookHandler *hh)
hh->ParamList["format"] = "xml";
hh->outStart();
int mode;
if (hh->ParamList["mode"] == "tv")
mode = CZapitClient::MODE_TV;
else if (hh->ParamList["mode"] == "radio")
mode = CZapitClient::MODE_RADIO;
else
mode = CZapitClient::MODE_ALL;
bool xml_cdata = false;
t_channel_id channel_id;
std::string result = "";
@@ -3268,8 +3276,10 @@ void CControlAPI::xmltvepgCGI(CyhookHandler *hh)
for (int m = CZapitClient::MODE_TV; m < CZapitClient::MODE_ALL; m++)
{
if (m == CZapitClient::MODE_RADIO)
if (mode == CZapitClient::MODE_RADIO || m == CZapitClient::MODE_RADIO)
g_bouquetManager->Bouquets[i]->getRadioChannels(chanlist);
else
g_bouquetManager->Bouquets[i]->getTvChannels(chanlist);
if(!chanlist.empty() && !g_bouquetManager->Bouquets[i]->bHidden && g_bouquetManager->Bouquets[i]->bUser)
{
@@ -3326,8 +3336,7 @@ void CControlAPI::xmltvepgCGI(CyhookHandler *hh)
void CControlAPI::xmltvm3uCGI(CyhookHandler *hh)
{
hh->outStart();
std::string result("#EXTM3U\n");
//hh->outStart();
int mode;
if (hh->ParamList["mode"] == "tv")
@@ -3347,6 +3356,16 @@ void CControlAPI::xmltvm3uCGI(CyhookHandler *hh)
char hostname[HOST_NAME_MAX];
gethostname(hostname, HOST_NAME_MAX);
std::string result("#EXTM3U");
result += " tvg-url=\"" + host + "/control/xmltv.xml";
if (mode == CZapitClient::MODE_TV)
result += "?mode=tv";
else if (mode == CZapitClient::MODE_RADIO)
result += "?mode=radio";
result += "\"\n";
// build url
std::string url = host;
if (url.rfind(":") != 4)