mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-30 17:01:15 +02:00
add simple Webif for WebTV WebRadio and xmltv
Conflicts: data/y-web/languages/Deutsch data/y-web/languages/English
This commit is contained in:
@@ -236,6 +236,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"},
|
||||
@@ -3400,6 +3401,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
|
||||
|
@@ -129,6 +129,7 @@ private:
|
||||
void updateBouquetCGI(CyhookHandler *hh);
|
||||
void xmltvepgCGI(CyhookHandler *hh);
|
||||
void xmltvm3uCGI(CyhookHandler *hh);
|
||||
void xmltvlistCGI(CyhookHandler *hh);
|
||||
void build_live_url(CyhookHandler *hh);
|
||||
void logoCGI(CyhookHandler *hh);
|
||||
void ConfigCGI(CyhookHandler *hh);
|
||||
|
@@ -126,6 +126,9 @@ const CNeutrinoYParser::TyFuncCall CNeutrinoYParser::yFuncCallList[]=
|
||||
{"set_timer_form", &CNeutrinoYParser::func_set_timer_form},
|
||||
{"bouquet_editor_main", &CNeutrinoYParser::func_bouquet_editor_main},
|
||||
{"set_bouquet_edit_form", &CNeutrinoYParser::func_set_bouquet_edit_form},
|
||||
{"get_webtv_list", &CNeutrinoYParser::func_get_webtv_list},
|
||||
{"get_webradio_list", &CNeutrinoYParser::func_get_webradio_list},
|
||||
{"get_xmltv_list", &CNeutrinoYParser::func_get_xmltv_list},
|
||||
};
|
||||
//-------------------------------------------------------------------------
|
||||
// y-func : dispatching and executing
|
||||
@@ -1258,3 +1261,27 @@ std::string CNeutrinoYParser::func_set_bouquet_edit_form(CyhookHandler *hh, std
|
||||
else
|
||||
return "No Bouquet selected";
|
||||
}
|
||||
|
||||
std::string CNeutrinoYParser::func_get_webtv_list(CyhookHandler *hh, std::string para)
|
||||
{
|
||||
std::string yresult;
|
||||
for (std::list<std::string>::iterator it = g_settings.webtv_xml.begin(); it != g_settings.webtv_xml.end(); it++)
|
||||
yresult += string_printf((*it).c_str()) + "\n";
|
||||
return yresult;
|
||||
}
|
||||
|
||||
std::string CNeutrinoYParser::func_get_webradio_list(CyhookHandler *hh, std::string para)
|
||||
{
|
||||
std::string yresult;
|
||||
for (std::list<std::string>::iterator it = g_settings.webradio_xml.begin(); it != g_settings.webradio_xml.end(); it++)
|
||||
yresult += string_printf((*it).c_str()) + "\n";
|
||||
return yresult;
|
||||
}
|
||||
|
||||
std::string CNeutrinoYParser::func_get_xmltv_list(CyhookHandler *hh, std::string para)
|
||||
{
|
||||
std::string yresult;
|
||||
for (std::list<std::string>::iterator it = g_settings.xmltv_xml.begin(); it != g_settings.xmltv_xml.end(); it++)
|
||||
yresult += string_printf((*it).c_str()) + "\n";
|
||||
return yresult;
|
||||
}
|
@@ -49,6 +49,9 @@ private:
|
||||
std::string func_set_timer_form(CyhookHandler *hh, std::string para);
|
||||
std::string func_bouquet_editor_main(CyhookHandler *hh, std::string para);
|
||||
std::string func_set_bouquet_edit_form(CyhookHandler *hh, std::string para);
|
||||
std::string func_get_webtv_list(CyhookHandler *hh, std::string para);
|
||||
std::string func_get_webradio_list(CyhookHandler *hh, std::string para);
|
||||
std::string func_get_xmltv_list(CyhookHandler *hh, std::string para);
|
||||
|
||||
protected:
|
||||
CNeutrinoAPI *NeutrinoAPI;
|
||||
|
Reference in New Issue
Block a user