Skip to content

Commit

Permalink
Merge pull request #323 from flubshi/omega_recording_group_radio
Browse files Browse the repository at this point in the history
Handle Kodi requesting radio for GetChannels and GetChannelGroups
  • Loading branch information
flubshi authored Jun 16, 2024
2 parents 9b947e4 + a50457e commit aaaa1b1
Showing 1 changed file with 29 additions and 11 deletions.
40 changes: 29 additions & 11 deletions src/WaipuData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -907,24 +907,28 @@ PVR_ERROR WaipuData::GetChannels(bool radio, kodi::addon::PVRChannelsResultSet&
if (!IsConnected())
return PVR_ERROR_SERVER_ERROR;

if (radio)
{
kodi::Log(ADDON_LOG_ERROR,
"[%s] ERROR: Function was called with invalid parameter 'radio: true'", __FUNCTION__);
return PVR_ERROR_INVALID_PARAMETERS;
}

kodi::Log(ADDON_LOG_DEBUG, "waipu.tv function call: [%s]", __FUNCTION__);
LoadChannelData();

for (const auto& channel : m_channels)
{
if (!radio)
{
kodi::addon::PVRChannel kodiChannel;
kodi::addon::PVRChannel kodiChannel;

kodiChannel.SetUniqueId(channel.iUniqueId);
kodiChannel.SetIsRadio(false);
kodiChannel.SetChannelNumber(channel.iChannelNumber);
kodiChannel.SetChannelName(channel.strChannelName);
kodiChannel.SetIconPath(channel.strIconPath);
kodiChannel.SetIsHidden(false);
kodiChannel.SetUniqueId(channel.iUniqueId);
kodiChannel.SetIsRadio(false);
kodiChannel.SetChannelNumber(channel.iChannelNumber);
kodiChannel.SetChannelName(channel.strChannelName);
kodiChannel.SetIconPath(channel.strIconPath);
kodiChannel.SetIsHidden(false);

results.Add(kodiChannel);
}
results.Add(kodiChannel);
}
return PVR_ERROR_NO_ERROR;
}
Expand Down Expand Up @@ -1034,6 +1038,13 @@ PVR_ERROR WaipuData::GetChannelGroups(bool radio, kodi::addon::PVRChannelGroupsR
if (!IsConnected())
return PVR_ERROR_SERVER_ERROR;

if (radio)
{
kodi::Log(ADDON_LOG_ERROR,
"[%s] ERROR: Function was called with invalid parameter 'radio: true'", __FUNCTION__);
return PVR_ERROR_INVALID_PARAMETERS;
}

LoadChannelData();
std::vector<WaipuChannelGroup>::iterator it;
for (it = m_channelGroups.begin(); it != m_channelGroups.end(); ++it)
Expand All @@ -1052,6 +1063,13 @@ PVR_ERROR WaipuData::GetChannelGroups(bool radio, kodi::addon::PVRChannelGroupsR
PVR_ERROR WaipuData::GetChannelGroupMembers(const kodi::addon::PVRChannelGroup& group,
kodi::addon::PVRChannelGroupMembersResultSet& results)
{
if (group.GetIsRadio())
{
kodi::Log(ADDON_LOG_ERROR,
"[%s] ERROR: Function was called with a group having 'radio: true'", __FUNCTION__);
return PVR_ERROR_INVALID_PARAMETERS;
}

LoadChannelData();
for (const auto& cgroup : m_channelGroups)
{
Expand Down

0 comments on commit aaaa1b1

Please sign in to comment.