Skip to content

Commit

Permalink
Merge pull request #754 from phunkyfish/remove-empty-groups-omega
Browse files Browse the repository at this point in the history
Remove empty media groups - Omega
  • Loading branch information
phunkyfish authored Apr 30, 2023

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
2 parents ea16951 + da4cc90 commit 7a4c7bc
Showing 6 changed files with 19 additions and 2 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="21.3.0"
version="21.3.1"
name="IPTV Simple Client"
provider-name="nightik and Ross Nicholson">
<requires>@ADDON_DEPENDS@
3 changes: 3 additions & 0 deletions pvr.iptvsimple/changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
v21.3.1
- Remove empty media groups before sending to Kodi PVR

v21.3.0
- Add settings options to add M3U group name to directory for media
- Add expert option to force the entire playlist to be Media. Useful now that multiple instances are supported
10 changes: 9 additions & 1 deletion src/iptvsimple/ChannelGroups.cpp
Original file line number Diff line number Diff line change
@@ -176,4 +176,12 @@ bool ChannelGroups::CheckChannelGroupAllowed(iptvsimple::data::ChannelGroup& new
}

return false;
}
}

void ChannelGroups::RemoveEmptyGroups()
{
m_channelGroups.erase(
std::remove_if(m_channelGroups.begin(), m_channelGroups.end(),
[](const ChannelGroup& channelGroup) { return channelGroup.IsEmpty(); }),
m_channelGroups.end());
}
1 change: 1 addition & 0 deletions src/iptvsimple/ChannelGroups.h
Original file line number Diff line number Diff line change
@@ -36,6 +36,7 @@ namespace iptvsimple
void Clear();
bool CheckChannelGroupAllowed(iptvsimple::data::ChannelGroup& newChannelGroup);
void ChannelGroupsLoadFailed() { m_channelGroupsLoadFailed = true; };
void RemoveEmptyGroups();

private:
const iptvsimple::Channels& m_channels;
3 changes: 3 additions & 0 deletions src/iptvsimple/PlaylistLoader.cpp
Original file line number Diff line number Diff line change
@@ -219,6 +219,9 @@ bool PlaylistLoader::LoadPlayList()

stream.clear();

//Now we need to remove any emptry channel groups. We do this as we may have added some while loading media entries.
m_channelGroups.RemoveEmptyGroups();

int milliseconds = std::chrono::duration_cast<std::chrono::milliseconds>(
std::chrono::high_resolution_clock::now() - started).count();

2 changes: 2 additions & 0 deletions src/iptvsimple/data/ChannelGroup.h
Original file line number Diff line number Diff line change
@@ -31,6 +31,8 @@ namespace iptvsimple
const std::vector<int>& GetMemberChannelIndexes() const { return m_memberChannelIndexes; }
void AddMemberChannelIndex(int channelIndex) { m_memberChannelIndexes.emplace_back(channelIndex); }

bool IsEmpty() const { return m_memberChannelIndexes.empty(); }

void UpdateTo(kodi::addon::PVRChannelGroup& left) const;

private:

0 comments on commit 7a4c7bc

Please sign in to comment.