Skip to content

Commit

Permalink
[pvr] fixed CPVRChannelGroup::SearchAndSetChannelIcons() after fef3f3a
Browse files Browse the repository at this point in the history
  • Loading branch information
opdenkamp committed Oct 28, 2012
1 parent 407596c commit 08e58ee
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 9 deletions.
28 changes: 19 additions & 9 deletions xbmc/pvr/channels/PVRChannelGroup.cpp
Expand Up @@ -211,6 +211,16 @@ bool CPVRChannelGroup::MoveChannel(unsigned int iOldChannelNumber, unsigned int
return true;
}

bool CPVRChannelGroup::SetChannelIconPath(CPVRChannelPtr channel, const std::string& strIconPath)
{
if (CFile::Exists(strIconPath))
{
channel->SetIconPath(strIconPath);
return true;
}
return false;
}

void CPVRChannelGroup::SearchAndSetChannelIcons(bool bUpdateDb /* = false */)
{
if (g_guiSettings.GetString("pvrmenu.iconpath").IsEmpty())
Expand Down Expand Up @@ -239,17 +249,17 @@ void CPVRChannelGroup::SearchAndSetChannelIcons(bool bUpdateDb /* = false */)
strIconPathUid.Format("%08d", groupMember.channel->UniqueID());
strIconPathUid = URIUtils::AddFileToFolder(strBasePath, strIconPathUid);

groupMember.channel->SetIconPath(strIconPath + ".tbn") ||
groupMember.channel->SetIconPath(strIconPath + ".jpg") ||
groupMember.channel->SetIconPath(strIconPath + ".png") ||
SetChannelIconPath(groupMember.channel, strIconPath + ".tbn") ||
SetChannelIconPath(groupMember.channel, strIconPath + ".jpg") ||
SetChannelIconPath(groupMember.channel, strIconPath + ".png") ||

groupMember.channel->SetIconPath(strIconPathLower + ".tbn") ||
groupMember.channel->SetIconPath(strIconPathLower + ".jpg") ||
groupMember.channel->SetIconPath(strIconPathLower + ".png") ||
SetChannelIconPath(groupMember.channel, strIconPathLower + ".tbn") ||
SetChannelIconPath(groupMember.channel, strIconPathLower + ".jpg") ||
SetChannelIconPath(groupMember.channel, strIconPathLower + ".png") ||

groupMember.channel->SetIconPath(strIconPathUid + ".tbn") ||
groupMember.channel->SetIconPath(strIconPathUid + ".jpg") ||
groupMember.channel->SetIconPath(strIconPathUid + ".png");
SetChannelIconPath(groupMember.channel, strIconPathUid + ".tbn") ||
SetChannelIconPath(groupMember.channel, strIconPathUid + ".jpg") ||
SetChannelIconPath(groupMember.channel, strIconPathUid + ".png");

if (bUpdateDb)
groupMember.channel->Persist();
Expand Down
8 changes: 8 additions & 0 deletions xbmc/pvr/channels/PVRChannelGroup.h
Expand Up @@ -369,6 +369,14 @@ namespace PVR
CPVRChannelPtr GetByClient(int iUniqueChannelId, int iClientID) const;

protected:
/*!
* @brief Set a new channel icon path if the path exists
* @param channel The channel to change
* @param strIconPath The new path
* @return True if the path exists, false otherwise
*/
bool SetChannelIconPath(CPVRChannelPtr channel, const std::string& strIconPath);

/*!
* @brief Load the channels stored in the database.
* @param bCompress If true, compress the database after storing the channels.
Expand Down

0 comments on commit 08e58ee

Please sign in to comment.