From 596d3902973b8ba2f9b7d62dd6e9d5d4c7a73729 Mon Sep 17 00:00:00 2001 From: TangoCash Date: Thu, 2 Jul 2020 15:35:46 +0200 Subject: [PATCH] fix epg mapping for multiple channels --- src/eitd/xmlutil.cpp | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/src/eitd/xmlutil.cpp b/src/eitd/xmlutil.cpp index 7f7fd2460..4d6ee8ac3 100644 --- a/src/eitd/xmlutil.cpp +++ b/src/eitd/xmlutil.cpp @@ -538,7 +538,8 @@ bool readEventsFromXMLTV(std::string &epgname, int &ev_count) t_channel_id getepgid(std::string epg_name) { - t_channel_id epgid; + t_channel_id epgid = 0; + bool match_found = false; CBouquetManager::ChannelIterator cit = g_bouquetManager->tvChannelsBegin(); @@ -557,16 +558,24 @@ t_channel_id getepgid(std::string epg_name) std::size_t found = tvg_id.find("#"+epg_name); if (found != std::string::npos) { - tvg_id = tvg_id.substr(tvg_id.find_first_of("=")); - sscanf(tvg_id.c_str(), "=%" SCNx64, &epgid); - return epgid; + if (match_found) + { + if ((*cit)->getEpgID() == epgid) continue; + (*cit)->setEPGid(epgid); + } + else + { + tvg_id = tvg_id.substr(tvg_id.find_first_of("=")); + sscanf(tvg_id.c_str(), "=%" SCNx64, &epgid); + match_found = true; + } } else continue; } } - return 0; + return epgid; } static int my_filter(const struct dirent *entry)