From 830d10ece30ec8a56946c5740d6cd04de964d147 Mon Sep 17 00:00:00 2001 From: svenhoefer Date: Mon, 13 Sep 2021 00:28:14 +0200 Subject: [PATCH] - bouquets: allow xmltv directly from webtv xml file Signed-off-by: Thilo Graf --- src/neutrino.cpp | 1 + src/neutrino.h | 38 ++++++++++++++++++++++++++++++-------- src/system/settings.h | 1 + src/zapit/src/bouquets.cpp | 6 ++++++ 4 files changed, 38 insertions(+), 8 deletions(-) diff --git a/src/neutrino.cpp b/src/neutrino.cpp index 7cfb915bd..5717cfe0c 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -968,6 +968,7 @@ int CNeutrinoApp::loadSetup(const char *fname) } } + g_settings.xmltv_xml_auto.clear(); g_settings.xmltv_xml_m3u.clear(); g_settings.livestreamResolution = configfile.getInt32("livestreamResolution", 1920); diff --git a/src/neutrino.h b/src/neutrino.h index 369f6c909..46c2fb4f2 100644 --- a/src/neutrino.h +++ b/src/neutrino.h @@ -242,13 +242,35 @@ public: void g_settings_video_Mode(int value) { g_settings.video_Mode = value; } - void g_settings_xmltv_xml_m3u_clear() { g_settings.xmltv_xml_m3u.clear(); } - void g_settings_xmltv_xml_m3u_pushback(std::string _epg_url) {g_settings.xmltv_xml_m3u.push_back(_epg_url); } - void xmltv_xml_readepg() { for (std::list::iterator it = g_settings.xmltv_xml.begin(); it != g_settings.xmltv_xml.end(); it++) - g_Sectionsd->readSIfromXMLTV((*it).c_str()); } - void xmltv_xml_m3u_readepg() { for (std::list::iterator it = g_settings.xmltv_xml_m3u.begin(); it != g_settings.xmltv_xml_m3u.end(); it++) - g_Sectionsd->readSIfromXMLTV((*it).c_str()); } + void g_settings_xmltv_xml_auto_clear() + { + g_settings.xmltv_xml_auto.clear(); + } + void g_settings_xmltv_xml_auto_pushback(std::string _xmltv_url) + { + if (find(g_settings.xmltv_xml_auto.begin(), g_settings.xmltv_xml_auto.end(), _xmltv_url) == g_settings.xmltv_xml_auto.end()) + g_settings.xmltv_xml_auto.push_back(_xmltv_url); + } + void xmltv_xml_readepg() + { + for (std::list::iterator it = g_settings.xmltv_xml.begin(); it != g_settings.xmltv_xml.end(); it++) + g_Sectionsd->readSIfromXMLTV((*it).c_str()); + for (std::list::iterator it = g_settings.xmltv_xml_auto.begin(); it != g_settings.xmltv_xml_auto.end(); it++) + g_Sectionsd->readSIfromXMLTV((*it).c_str()); + } + + void g_settings_xmltv_xml_m3u_clear() + { + g_settings.xmltv_xml_m3u.clear(); + } + void g_settings_xmltv_xml_m3u_pushback(std::string _epg_url) + { + g_settings.xmltv_xml_m3u.push_back(_epg_url); + } + void xmltv_xml_m3u_readepg() + { + for (std::list::iterator it = g_settings.xmltv_xml_m3u.begin(); it != g_settings.xmltv_xml_m3u.end(); it++) + g_Sectionsd->readSIfromXMLTV((*it).c_str()); + } }; #endif - - diff --git a/src/system/settings.h b/src/system/settings.h index 81f44a481..318c86b2f 100644 --- a/src/system/settings.h +++ b/src/system/settings.h @@ -748,6 +748,7 @@ struct SNeutrinoSettings // xmltv std::list xmltv_xml; // see http://wiki.xmltv.org/ + std::list xmltv_xml_auto; std::list xmltv_xml_m3u; // contains temp xml from m3u int livestreamResolution; diff --git a/src/zapit/src/bouquets.cpp b/src/zapit/src/bouquets.cpp index 4cc76f958..4b8e98e8a 100644 --- a/src/zapit/src/bouquets.cpp +++ b/src/zapit/src/bouquets.cpp @@ -534,6 +534,7 @@ void CBouquetManager::loadBouquets(bool ignoreBouquetFile) sortBouquets(); } + CNeutrinoApp::getInstance()->g_settings_xmltv_xml_auto_clear(); CNeutrinoApp::getInstance()->g_settings_xmltv_xml_m3u_clear(); loadWebtv(); loadWebradio(); @@ -933,6 +934,7 @@ void CBouquetManager::loadWebchannels(int mode) const char *desc = xmlGetAttribute(l1, "description"); const char *genre = xmlGetAttribute(l1, "genre"); const char *epgid = xmlGetAttribute(l1, "epgid"); + const char *xmltv = xmlGetAttribute(l1, "xmltv"); const char *epgmap = xmlGetAttribute(l1, "epgmap"); const char *script = xmlGetAttribute(l1, "script"); t_channel_id epg_id = 0; @@ -973,6 +975,10 @@ void CBouquetManager::loadWebchannels(int mode) channel->setEPGid(new_epgid); char buf[100]; snprintf(buf, sizeof(buf), "%llx", chid & 0xFFFFFFFFFFFFULL); + if (xmltv) + { + CNeutrinoApp::getInstance()->g_settings_xmltv_xml_auto_pushback(xmltv); + } if (epgmap) { std::string new_epgxml(epgmap);