Skip to content

Commit

Permalink
Mediaportal pvr addon: don't return radio channels/channelgroup/chann…
Browse files Browse the repository at this point in the history
…elgroup mappings when radio support is disabled.

+ debug cosmetics
  • Loading branch information
margro committed Aug 17, 2011
1 parent c8b1623 commit 83984d1
Showing 1 changed file with 41 additions and 10 deletions.
51 changes: 41 additions & 10 deletions xbmc/pvrclients/MediaPortal/pvrclient-mediaportal.cpp
Expand Up @@ -579,20 +579,35 @@ PVR_ERROR cPVRClientMediaPortal::GetChannels(PVR_HANDLE handle, bool bRadio)


if(bRadio) if(bRadio)
{ {
XBMC->Log(LOG_DEBUG, "RequestChannelList for Radio group:%s", g_szRadioGroup.c_str());

if(!g_bRadioEnabled) if(!g_bRadioEnabled)
{ {
XBMC->Log(LOG_INFO, "Fetching radio channels is disabled."); XBMC->Log(LOG_INFO, "Fetching radio channels is disabled.");
return PVR_ERROR_NO_ERROR; return PVR_ERROR_NO_ERROR;
} }


command.Format("ListRadioChannels:%s\n", uri::encode(uri::PATH_TRAITS, g_szRadioGroup).c_str()); if (g_szRadioGroup.length() > 0)
{
XBMC->Log(LOG_DEBUG, "GetChannels(radio) for radio group:%s", g_szRadioGroup.c_str());
command.Format("ListRadioChannels:%s\n", uri::encode(uri::PATH_TRAITS, g_szRadioGroup).c_str());
}
else
{
XBMC->Log(LOG_DEBUG, "GetChannels(radio) all channels");
command = "ListRadioChannels\n";
}
} }
else else
{ {
XBMC->Log(LOG_DEBUG, "RequestChannelList for TV group:%s", g_szTVGroup.c_str()); if (g_szTVGroup.length() > 0)
command.Format("ListTVChannels:%s\n", uri::encode(uri::PATH_TRAITS, g_szTVGroup).c_str()); {
XBMC->Log(LOG_DEBUG, "GetChannels(tv) for TV group:%s", g_szTVGroup.c_str());
command.Format("ListTVChannels:%s\n", uri::encode(uri::PATH_TRAITS, g_szTVGroup).c_str());
}
else
{
XBMC->Log(LOG_DEBUG, "GetChannels(tv) all channels");
command = "ListTVChannels\n";
}
} }


if( !SendCommand2(command.c_str(), code, lines) ) if( !SendCommand2(command.c_str(), code, lines) )
Expand Down Expand Up @@ -692,9 +707,17 @@ PVR_ERROR cPVRClientMediaPortal::GetChannelGroups(PVR_HANDLE handle, bool bRadio


if(bRadio) if(bRadio)
{ {
XBMC->Log(LOG_DEBUG, "GetChannelGroups for radio"); if (g_bRadioEnabled)
if (!SendCommand2("ListRadioGroups\n", code, lines)) {
return PVR_ERROR_SERVER_ERROR; XBMC->Log(LOG_DEBUG, "GetChannelGroups for radio");
if (!SendCommand2("ListRadioGroups\n", code, lines))
return PVR_ERROR_SERVER_ERROR;
}
else
{
XBMC->Log(LOG_DEBUG, "Skipping GetChannelGroups for radio. Radio support is disabled.");
return PVR_ERROR_NO_ERROR;
}
} }
else else
{ {
Expand Down Expand Up @@ -742,8 +765,16 @@ PVR_ERROR cPVRClientMediaPortal::GetChannelGroupMembers(PVR_HANDLE handle, const


if(group.bIsRadio) if(group.bIsRadio)
{ {
XBMC->Log(LOG_DEBUG, "%s: for group '%s', radio=%i", __FUNCTION__, group.strGroupName, group.bIsRadio); if (g_bRadioEnabled)
command.Format("ListRadioChannels:%s\n", uri::encode(uri::PATH_TRAITS, group.strGroupName).c_str()); {
XBMC->Log(LOG_DEBUG, "%s: for group '%s', radio=%i", __FUNCTION__, group.strGroupName, group.bIsRadio);
command.Format("ListRadioChannels:%s\n", uri::encode(uri::PATH_TRAITS, group.strGroupName).c_str());
}
else
{
XBMC->Log(LOG_DEBUG, "Skipping GetChannelGroupMembers for radio. Radio support is disabled.");
return PVR_ERROR_NO_ERROR;
}
} }
else else
{ {
Expand Down

0 comments on commit 83984d1

Please sign in to comment.