add function to dump current epg mappings

Signed-off-by: Thilo Graf <dbt@novatux.de>
This commit is contained in:
TangoCash
2018-10-28 11:51:20 +01:00
committed by Thilo Graf
parent 45c29614ba
commit 56457e46cf
2 changed files with 28 additions and 0 deletions

View File

@@ -111,6 +111,7 @@ class CBouquetManager
t_channel_id reMapEpgID(t_channel_id channelid);
std::string reMapEpgXML(t_channel_id channelid);
void convert_E2_EPGMapping(std::string mapfile_in, std::string mapfile_out = "/tmp/epgmap.xml");
void dump_EPGMapping(std::string mapfile_out = "/tmp/epgmap.xml");
//logo downloads
static void* LogoThread(void* _logolist);
pthread_t thrLogo;

View File

@@ -1357,6 +1357,33 @@ void CBouquetManager::convert_E2_EPGMapping(std::string mapfile_in, std::string
xmlFreeDoc(epgmap_parser);
}
void CBouquetManager::dump_EPGMapping(std::string mapfile_out)
{
FILE * outfile = NULL;
CBouquetManager::ChannelIterator cit = g_bouquetManager->tvChannelsBegin();
outfile = fopen(mapfile_out.c_str(), "w");
fprintf(outfile,
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
"<zapit>\n");
for (; !(cit.EndOfChannels()); cit++)
{
if ((*cit)->getChannelID() != (*cit)->getEpgID())
fprintf(outfile,"\t<filter channel_id=\"%012" PRIx64 "\" new_epg_id=\"%012" PRIx64 "\" /> --%s\n",(*cit)->getChannelID(), (*cit)->getEpgID(), (*cit)->getName().c_str());
std::string tvg_id = (*cit)->getScriptName();
if (tvg_id.empty())
continue;
tvg_id = tvg_id.substr(1,tvg_id.find_first_of("=")-1);
fprintf(outfile,"\t<filter channel_id=\"%012" PRIx64 "\" >%s</filter> --%s\n",(*cit)->getChannelID(), tvg_id.c_str(), (*cit)->getName().c_str());
}
fprintf(outfile, "</zapit>\n");
fclose(outfile);
}
std::string CBouquetManager::ReadMarkerValue(std::string strLine, const char* strMarkerName)
{
if (strLine.find(strMarkerName) != std::string::npos)