From b83daf41680e62e652f83168d20d176e9506a79b Mon Sep 17 00:00:00 2001 From: vanhofen Date: Thu, 10 Nov 2016 15:24:38 +0100 Subject: [PATCH] webtv: try to auto-add epg from existing channels (experimental) Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/8d4576535fa12c170ffb76b2903a74c7595c9835 Author: vanhofen 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 --- src/zapit/include/zapit/getservices.h | 1 + src/zapit/src/bouquets.cpp | 13 +++++++++++++ src/zapit/src/getservices.cpp | 12 ++++++++++++ 3 files changed, 26 insertions(+) diff --git a/src/zapit/include/zapit/getservices.h b/src/zapit/include/zapit/getservices.h index ae9e99060..187c18646 100644 --- a/src/zapit/include/zapit/getservices.h +++ b/src/zapit/include/zapit/getservices.h @@ -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, diff --git a/src/zapit/src/bouquets.cpp b/src/zapit/src/bouquets.cpp index 271751cd0..3cd99fa4d 100644 --- a/src/zapit/src/bouquets.cpp +++ b/src/zapit/src/bouquets.cpp @@ -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) { diff --git a/src/zapit/src/getservices.cpp b/src/zapit/src/getservices.cpp index bec073eeb..0d9fac984 100644 --- a/src/zapit/src/getservices.cpp +++ b/src/zapit/src/getservices.cpp @@ -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);