add simple Webif for WebTV WebRadio and xmltv

Origin commit data
------------------
Branch: ni/coolstream
Commit: 3ba1d4704a
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 23:32:37 +02:00
committed by vanhofen
parent eece9dbc66
commit 9ff19d2b8e
9 changed files with 165 additions and 0 deletions

View File

@@ -242,6 +242,7 @@ const CControlAPI::TyCgiCall CControlAPI::yCgiCallList[]=
{"xmltv.data", &CControlAPI::xmltvepgCGI, "+xml"},
{"xmltv.xml", &CControlAPI::xmltvepgCGI, "+xml"},
{"xmltv.m3u", &CControlAPI::xmltvm3uCGI, ""},
{"xmltvlist", &CControlAPI::xmltvlistCGI, "text/plain"},
// utils
{"build_live_url", &CControlAPI::build_live_url, ""},
{"get_logo", &CControlAPI::logoCGI, "text/plain"},
@@ -3415,6 +3416,70 @@ void CControlAPI::xmltvm3uCGI(CyhookHandler *hh)
hh->SendResult(result);
}
void CControlAPI::xmltvlistCGI(CyhookHandler *hh)
{
std::vector<std::string>::iterator it;
std::vector<std::string> url_list;
std::string tmp;
std::string::size_type i = 0;
if (!hh->ParamList["webtv"].empty())
{
std::string webtv_url = hh->ParamList["webtv"];
g_settings.webtv_xml.clear();
url_list = ::split(webtv_url, '\n');
for (it = url_list.begin(); it != url_list.end(); it++)
{
tmp = (*it);
tmp.erase(std::remove(tmp.begin(), tmp.end(), '\n'), tmp.end());
tmp.erase(std::remove(tmp.begin(), tmp.end(), '\r'), tmp.end());
tmp.erase(std::remove(tmp.begin(), tmp.end(), '\t'), tmp.end());
if (!tmp.empty())
g_settings.webtv_xml.push_back(tmp);
}
}
else
g_settings.webtv_xml.clear();
if (!hh->ParamList["webradio"].empty())
{
std::string webradio_url = hh->ParamList["webradio"];
g_settings.webradio_xml.clear();
url_list = ::split(webradio_url, '\n');
for (it = url_list.begin(); it != url_list.end(); it++)
{
tmp = (*it);
tmp.erase(std::remove(tmp.begin(), tmp.end(), '\n'), tmp.end());
tmp.erase(std::remove(tmp.begin(), tmp.end(), '\r'), tmp.end());
tmp.erase(std::remove(tmp.begin(), tmp.end(), '\t'), tmp.end());
if (!tmp.empty())
g_settings.webradio_xml.push_back(tmp);
}
}
else
g_settings.webradio_xml.clear();
if (!hh->ParamList["xmltv"].empty())
{
std::string xmltv_url = hh->ParamList["xmltv"];
g_settings.xmltv_xml.clear();
url_list = ::split(xmltv_url, '\n');
for (it = url_list.begin(); it != url_list.end(); it++)
{
tmp = (*it);
tmp.erase(std::remove(tmp.begin(), tmp.end(), '\n'), tmp.end());
tmp.erase(std::remove(tmp.begin(), tmp.end(), '\r'), tmp.end());
tmp.erase(std::remove(tmp.begin(), tmp.end(), '\t'), tmp.end());
if (!tmp.empty())
g_settings.xmltv_xml.push_back(tmp);
}
}
else
g_settings.xmltv_xml.clear();
hh->SendOk();
}
//-------------------------------------------------------------------------
// audio_no : (optional) audio channel
// host : (optional) ip of dbox