bouquets: allow multiple epgmap.xml

Origin commit data
------------------
Branch: ni/coolstream
Commit: ef45ef8c9c
Author: vanhofen <vanhofen@gmx.de>
Date: 2021-09-11 (Sat, 11 Sep 2021)

Origin message was:
------------------
- bouquets: allow multiple epgmap.xml

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

------------------
This commit was generated by Migit
This commit is contained in:
vanhofen
2021-09-11 18:07:02 +02:00
parent 9f32a3dbfc
commit 1d6336b240
2 changed files with 34 additions and 2 deletions

View File

@@ -302,6 +302,10 @@ bool CWebChannelsSetup::changeNotify(const neutrino_locale_t OptionName, void */
int filefilter(const struct dirent *entry)
{
std::string f = entry->d_name;
if (f.find("epgmap.xml") != std::string::npos)
return 0;
int len = strlen(entry->d_name);
if (len > 3 && (
(entry->d_name[len - 3] == 'x' && entry->d_name[len - 2] == 'm' && entry->d_name[len - 1] == 'l')

View File

@@ -31,6 +31,7 @@
#include <sys/stat.h>
#include <sys/time.h>
#include <unistd.h>
#include <dirent.h>
#include <fstream>
#include <iostream>
@@ -1366,8 +1367,33 @@ void CBouquetManager::readEPGMapping()
if(!EpgXMLMapping.empty())
EpgXMLMapping.clear();
const std::string epg_map_dir = CONFIGDIR "/zapit/epgmap.xml";
xmlDocPtr epgmap_parser = parseXmlFile(epg_map_dir.c_str());
std::list<std::string> epgmap_dirs;
epgmap_dirs.push_back(CONFIGDIR "/zapit");
epgmap_dirs.push_back(WEBTVDIR);
epgmap_dirs.push_back(WEBTVDIR_VAR);
std::list<std::string> epgmaps;
for (std::list<std::string>::iterator it = epgmap_dirs.begin(); it != epgmap_dirs.end(); ++it)
{
DIR *dp;
struct dirent *d;
if ((dp = opendir((*it).c_str())) == NULL)
continue;
while ((d = readdir(dp)) != NULL)
{
std::string f = d->d_name;
if(f.find("epgmap.xml") != std::string::npos)
epgmaps.push_back((*it) + "/" + f);
}
}
for (std::list<std::string>::iterator it = epgmaps.begin(); it != epgmaps.end(); ++it)
{
INFO("read %s", (*it).c_str());
xmlDocPtr epgmap_parser = parseXmlFile((*it).c_str());
if (epgmap_parser != NULL)
{
@@ -1397,6 +1423,8 @@ void CBouquetManager::readEPGMapping()
}
}
xmlFreeDoc(epgmap_parser);
} // for loop
}
void CBouquetManager::convert_E2_EPGMapping(std::string mapfile_in, std::string mapfile_out)