From 2e3b41b66ffdebc948a77c827adba4fd13f70e28 Mon Sep 17 00:00:00 2001 From: phunkyfish Date: Mon, 4 Nov 2024 10:07:50 +0000 Subject: [PATCH] Set backend position for channel groups --- src/iptvsimple/ChannelGroups.cpp | 2 ++ src/iptvsimple/ChannelGroups.h | 2 ++ src/iptvsimple/data/ChannelGroup.cpp | 2 +- src/iptvsimple/data/ChannelGroup.h | 4 ++++ 4 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/iptvsimple/ChannelGroups.cpp b/src/iptvsimple/ChannelGroups.cpp index 094bb1760..70e768729 100644 --- a/src/iptvsimple/ChannelGroups.cpp +++ b/src/iptvsimple/ChannelGroups.cpp @@ -27,6 +27,7 @@ void ChannelGroups::Clear() { m_channelGroups.clear(); m_channelGroupsLoadFailed = false; + m_groupBackendOrderPosition = 0; } int ChannelGroups::GetChannelGroupsAmount() const @@ -115,6 +116,7 @@ int ChannelGroups::AddChannelGroup(iptvsimple::data::ChannelGroup& channelGroup) if (!existingChannelGroup) { channelGroup.SetUniqueId(m_channelGroups.size() + 1); + channelGroup.SetPosition(m_groupBackendOrderPosition++); m_channelGroups.emplace_back(channelGroup); diff --git a/src/iptvsimple/ChannelGroups.h b/src/iptvsimple/ChannelGroups.h index ba9c560a3..89dd2d833 100644 --- a/src/iptvsimple/ChannelGroups.h +++ b/src/iptvsimple/ChannelGroups.h @@ -44,6 +44,8 @@ namespace iptvsimple bool m_channelGroupsLoadFailed = false; + int m_groupBackendOrderPosition; + std::shared_ptr m_settings; }; } //namespace iptvsimple diff --git a/src/iptvsimple/data/ChannelGroup.cpp b/src/iptvsimple/data/ChannelGroup.cpp index 2bc0ffeca..a570ce52a 100644 --- a/src/iptvsimple/data/ChannelGroup.cpp +++ b/src/iptvsimple/data/ChannelGroup.cpp @@ -13,6 +13,6 @@ using namespace iptvsimple::data; void ChannelGroup::UpdateTo(kodi::addon::PVRChannelGroup& left) const { left.SetIsRadio(m_radio); - left.SetPosition(0); // groups default order, unused + left.SetPosition(m_position); left.SetGroupName(m_groupName); } diff --git a/src/iptvsimple/data/ChannelGroup.h b/src/iptvsimple/data/ChannelGroup.h index 430bfcbca..3be6cec40 100644 --- a/src/iptvsimple/data/ChannelGroup.h +++ b/src/iptvsimple/data/ChannelGroup.h @@ -25,6 +25,9 @@ namespace iptvsimple int GetUniqueId() const { return m_uniqueId; } void SetUniqueId(int value) { m_uniqueId = value; } + int GetPosition() const { return m_position; } + void SetPosition(int value) { m_position = value; } + const std::string& GetGroupName() const { return m_groupName; } void SetGroupName(const std::string& value) { m_groupName = value; } @@ -38,6 +41,7 @@ namespace iptvsimple private: bool m_radio; int m_uniqueId; + int m_position; std::string m_groupName; std::vector m_memberChannelIndexes; };