Skip to content
This repository has been archived by the owner on Apr 15, 2023. It is now read-only.

Commit

Permalink
epg: fix wrong in-memory epg entries due to wrong searching by channe…
Browse files Browse the repository at this point in the history
…l id instead of epg id. Fixes delay during startup and (hopefully) all other epg related problems.
  • Loading branch information
nemphys committed May 9, 2011
1 parent 048ddb1 commit 81ff474
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 1 deletion.
1 change: 1 addition & 0 deletions xbmc/epg/Epg.cpp
Expand Up @@ -686,6 +686,7 @@ const CDateTime &CEpg::GetLastDate(void) const
bool CEpg::Update(const CEpg &epg, bool bUpdateDb /* = false */)
{
bool bReturn = true;
CSingleLock lock(m_critSection);

m_strName = epg.m_strName;
m_strScraperName = epg.m_strScraperName;
Expand Down
18 changes: 18 additions & 0 deletions xbmc/pvr/channels/PVRChannelGroup.cpp
Expand Up @@ -297,6 +297,24 @@ const CPVRChannel *CPVRChannelGroup::GetByChannelID(int iChannelID) const
return channel;
}

const CPVRChannel *CPVRChannelGroup::GetByChannelEpgID(int iEpgID) const
{
CPVRChannel *channel = NULL;
CSingleLock lock(m_critSection);

for (unsigned int ptr = 0; ptr < size(); ptr++)
{
PVRChannelGroupMember groupMember = at(ptr);
if (groupMember.channel->EpgID() == iEpgID)
{
channel = groupMember.channel;
break;
}
}

return channel;
}

const CPVRChannel *CPVRChannelGroup::GetByUniqueID(int iUniqueID) const
{
CPVRChannel *channel = NULL;
Expand Down
7 changes: 7 additions & 0 deletions xbmc/pvr/channels/PVRChannelGroup.h
Expand Up @@ -298,6 +298,13 @@ namespace PVR
*/
virtual const CPVRChannel *GetByChannelID(int iChannelID) const;

/*!
* @brief Get a channel given it's EPG ID.
* @param iEpgID The channel EPG ID.
* @return The channel or NULL if it wasn't found.
*/
virtual const CPVRChannel *GetByChannelEpgID(int iEpgID) const;

/*!
* @brief Get a channel given it's unique ID.
* @param iUniqueID The unique ID.
Expand Down
10 changes: 10 additions & 0 deletions xbmc/pvr/channels/PVRChannelGroupsContainer.cpp
Expand Up @@ -134,6 +134,16 @@ const CPVRChannel *CPVRChannelGroupsContainer::GetChannelById(int iChannelId) co
return channel;
}

const CPVRChannel *CPVRChannelGroupsContainer::GetChannelByEpgId(int iEpgId) const
{
const CPVRChannel *channel = m_groupsTV->GetGroupAll()->GetByChannelEpgID(iEpgId);

if (!channel)
channel = m_groupsRadio->GetGroupAll()->GetByChannelEpgID(iEpgId);

return channel;
}

bool CPVRChannelGroupsContainer::GetGroupsDirectory(const CStdString &strBase, CFileItemList *results, bool bRadio)
{
const CPVRChannelGroups *channelGroups = Get(bRadio);
Expand Down
7 changes: 7 additions & 0 deletions xbmc/pvr/channels/PVRChannelGroupsContainer.h
Expand Up @@ -131,6 +131,13 @@ namespace PVR
*/
const CPVRChannel *GetChannelById(int iChannelId) const;

/*!
* @brief Get a channel given it's EPG ID.
* @param iEpgId The EPG ID of the channel.
* @return The channel or NULL if it wasn't found.
*/
const CPVRChannel *GetChannelByEpgId(int iEpgId) const;

/*!
* @brief Get the groups list for a directory.
* @param strBase The directory path.
Expand Down
2 changes: 1 addition & 1 deletion xbmc/pvr/epg/PVREpgContainer.cpp
Expand Up @@ -79,7 +79,7 @@ bool PVR::CPVREpgContainer::AutoCreateTablesHook(void)

CEpg* PVR::CPVREpgContainer::CreateEpg(int iEpgId)
{
CPVRChannel *channel = (CPVRChannel *) g_PVRChannelGroups->GetChannelById(iEpgId);
CPVRChannel *channel = (CPVRChannel *) g_PVRChannelGroups->GetChannelByEpgId(iEpgId);
if (channel)
{
return new CPVREpg(channel, false);
Expand Down

0 comments on commit 81ff474

Please sign in to comment.