Skip to content

Commit

Permalink
Set backend position for channel groups
Browse files Browse the repository at this point in the history
  • Loading branch information
phunkyfish committed Nov 4, 2024
1 parent 4665d80 commit 2e3b41b
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/iptvsimple/ChannelGroups.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ void ChannelGroups::Clear()
{
m_channelGroups.clear();
m_channelGroupsLoadFailed = false;
m_groupBackendOrderPosition = 0;
}

int ChannelGroups::GetChannelGroupsAmount() const
Expand Down Expand Up @@ -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);

Expand Down
2 changes: 2 additions & 0 deletions src/iptvsimple/ChannelGroups.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ namespace iptvsimple

bool m_channelGroupsLoadFailed = false;

int m_groupBackendOrderPosition;

std::shared_ptr<iptvsimple::InstanceSettings> m_settings;
};
} //namespace iptvsimple
2 changes: 1 addition & 1 deletion src/iptvsimple/data/ChannelGroup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
4 changes: 4 additions & 0 deletions src/iptvsimple/data/ChannelGroup.h
Original file line number Diff line number Diff line change
Expand Up @@ -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; }

Expand All @@ -38,6 +41,7 @@ namespace iptvsimple
private:
bool m_radio;
int m_uniqueId;
int m_position;
std::string m_groupName;
std::vector<int> m_memberChannelIndexes;
};
Expand Down

0 comments on commit 2e3b41b

Please sign in to comment.