webtv: try to auto-add epg from existing channels (experimental)

Origin commit data
------------------
Branch: ni/coolstream
Commit: 8d4576535f
Author: vanhofen <vanhofen@gmx.de>
Date: 2016-11-10 (Thu, 10 Nov 2016)

Origin message was:
------------------
- webtv: try to auto-add epg from existing channels (experimental)

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

------------------
This commit was generated by Migit
This commit is contained in:
vanhofen
2016-11-10 15:24:38 +01:00
parent 3a6109ce9e
commit b83daf4168
3 changed files with 26 additions and 0 deletions

View File

@@ -129,6 +129,7 @@ class CServiceManager
CZapitChannel* FindChannel(const t_channel_id channel_id, bool * current_is_nvod = NULL);
CZapitChannel* FindChannelByName(std::string name);
CZapitChannel* FindChannelByPattern(std::string pattern); //NI
CZapitChannel* FindCurrentChannel(const t_channel_id channel_id);
CZapitChannel* FindChannel48(const t_channel_id channel_id);
CZapitChannel* FindChannelFuzzy(const t_channel_id channel_id,

View File

@@ -840,7 +840,20 @@ void CBouquetManager::loadWebtv()
const char *script = xmlGetAttribute(l1, "script");
t_channel_id epg_id = 0;
if (epgid)
{
//NI
if (strcmp(epgid, "auto") == 0 && title)
{
CZapitChannel * channel = CServiceManager::getInstance()->FindChannelByPattern(title);
if (channel)
{
epg_id = channel->getChannelID();
INFO("* auto epg_id found for %s: " PRINTF_CHANNEL_ID_TYPE "\n", title, epg_id);
}
}
else
epg_id = strtoull(epgid, NULL, 16);
}
CZapitBouquet* gbouquet = pbouquet;
if (genre) {

View File

@@ -220,6 +220,18 @@ CZapitChannel * CServiceManager::FindChannelByName(std::string name)
return NULL;
}
//NI
CZapitChannel * CServiceManager::FindChannelByPattern(std::string pattern)
{
for (channel_map_iterator_t it = allchans.begin(); it != allchans.end(); ++it) {
//INFO("searching for %s in %s", pattern.c_str(), it->second.getName().c_str());
if (strncasecmp(it->second.getName().c_str(), pattern.c_str(), pattern.length()) == 0) {
return &it->second;
}
}
return NULL;
}
CZapitChannel * CServiceManager::FindCurrentChannel(const t_channel_id channel_id)
{
channel_map_iterator_t cit = curchans.find(channel_id);