Skip to content

Commit

Permalink
Merge pull request #153 from flubshi/Krypton
Browse files Browse the repository at this point in the history
Backport: Added support for multiple groups per channel, separated by…
  • Loading branch information
Jalle19 authored Aug 17, 2017
2 parents b1eac6e + 0914e79 commit 2a649d7
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 17 deletions.
2 changes: 1 addition & 1 deletion pvr.iptvsimple/addon.xml.in
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<addon
id="pvr.iptvsimple"
version="2.4.13"
version="2.4.14"
name="PVR IPTV Simple Client"
provider-name="nightik">
<requires>
Expand Down
3 changes: 3 additions & 0 deletions pvr.iptvsimple/changelog.txt
Original file line number Diff line number Diff line change
@@ -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
Expand Down
41 changes: 25 additions & 16 deletions src/PVRIptvData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<int> iCurrentGroupId;

PVRIptvChannel tmpChannel;
tmpChannel.strTvgId = "";
Expand Down Expand Up @@ -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);
}
}

}
}
}
Expand All @@ -468,10 +476,11 @@ bool PVRIptvData::LoadPlayList(void)

iChannelNum++;

if (iCurrentGroupId > 0)
std::vector<int>::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);
Expand Down

0 comments on commit 2a649d7

Please sign in to comment.