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);