From 0914e79c7109b6ec2bc027caecbd3b00f7747a39 Mon Sep 17 00:00:00 2001 From: flubshi Date: Wed, 16 Aug 2017 23:19:07 +0200 Subject: [PATCH] Backport: Added support for multiple groups per channel, separated by semicolon --- pvr.iptvsimple/addon.xml.in | 2 +- pvr.iptvsimple/changelog.txt | 3 +++ src/PVRIptvData.cpp | 41 ++++++++++++++++++++++-------------- 3 files changed, 29 insertions(+), 17 deletions(-) diff --git a/pvr.iptvsimple/addon.xml.in b/pvr.iptvsimple/addon.xml.in index f5a0abd26..a38e74634 100644 --- a/pvr.iptvsimple/addon.xml.in +++ b/pvr.iptvsimple/addon.xml.in @@ -1,7 +1,7 @@ diff --git a/pvr.iptvsimple/changelog.txt b/pvr.iptvsimple/changelog.txt index 8ee8fe3de..de887e1bb 100644 --- a/pvr.iptvsimple/changelog.txt +++ b/pvr.iptvsimple/changelog.txt @@ -1,3 +1,6 @@ +v2.4.14 +- Backport: Added support for multiple groups per channel, separated by semicolon + v2.4.13 - fixed install path in the Debian package - remove line size limitation when parsing M3U files diff --git a/src/PVRIptvData.cpp b/src/PVRIptvData.cpp index 3f43ee0f3..1a523b54d 100644 --- a/src/PVRIptvData.cpp +++ b/src/PVRIptvData.cpp @@ -316,9 +316,9 @@ bool PVRIptvData::LoadPlayList(void) int iChannelIndex = 0; int iUniqueGroupId = 0; - int iCurrentGroupId = 0; int iChannelNum = g_iStartNumber; int iEPGTimeShift = 0; + std::vector iCurrentGroupId; PVRIptvChannel tmpChannel; tmpChannel.strTvgId = ""; @@ -428,23 +428,31 @@ bool PVRIptvData::LoadPlayList(void) if (!strGroupName.empty()) { - strGroupName = XBMC->UnknownToUTF8(strGroupName.c_str()); + std::stringstream streamGroups(strGroupName); PVRIptvChannelGroup * pGroup; - if ((pGroup = FindGroup(strGroupName)) == NULL) - { - PVRIptvChannelGroup group; - group.strGroupName = strGroupName; - group.iGroupId = ++iUniqueGroupId; - group.bRadio = bRadio; + iCurrentGroupId.clear(); - m_groups.push_back(group); - iCurrentGroupId = iUniqueGroupId; - } - else + while(std::getline(streamGroups, strGroupName, ';')) { - iCurrentGroupId = pGroup->iGroupId; + strGroupName = XBMC->UnknownToUTF8(strGroupName.c_str()); + + if ((pGroup = FindGroup(strGroupName)) == NULL) + { + PVRIptvChannelGroup group; + group.strGroupName = strGroupName; + group.iGroupId = ++iUniqueGroupId; + group.bRadio = bRadio; + + m_groups.push_back(group); + iCurrentGroupId.push_back(iUniqueGroupId); + } + else + { + iCurrentGroupId.push_back(pGroup->iGroupId); + } } + } } } @@ -468,10 +476,11 @@ bool PVRIptvData::LoadPlayList(void) iChannelNum++; - if (iCurrentGroupId > 0) + std::vector::iterator it; + for (auto it = iCurrentGroupId.begin(); it != iCurrentGroupId.end(); ++it) { - channel.bRadio = m_groups.at(iCurrentGroupId - 1).bRadio; - m_groups.at(iCurrentGroupId - 1).members.push_back(iChannelIndex); + channel.bRadio = m_groups.at(*it - 1).bRadio; + m_groups.at(*it - 1).members.push_back(iChannelIndex); } m_channels.push_back(channel);