Permalink
Browse files

EpgContainer: Fix next ID size when loading from db and remove old/un…

…used epg channels

Signed-off-by: Jernej Fijačko <jernej@jernej.org>
  • Loading branch information...
1 parent 4f8709b commit bde8c910002caeb713405fe2837d498a01dbe84d @mikrohard committed Jun 12, 2012
Showing with 12 additions and 0 deletions.
  1. +12 −0 xbmc/epg/EpgContainer.cpp
View
12 xbmc/epg/EpgContainer.cpp
@@ -281,6 +281,8 @@ bool CEpgContainer::UpdateEntry(const CEpg &entry, bool bUpdateDatabase /* = fal
{
/* table does not exist yet, create a new one */
unsigned int iEpgId = m_bIgnoreDbForClient || entry.EpgID() <= 0 ? NextEpgId() : entry.EpgID();
+ if (m_iNextEpgId < iEpgId)
+ m_iNextEpgId = iEpgId + 1;
epg = CreateEpg(iEpgId);
if (epg)
{
@@ -293,6 +295,16 @@ bool CEpgContainer::UpdateEntry(const CEpg &entry, bool bUpdateDatabase /* = fal
bReturn = epg->UpdateMetadata(entry, bUpdateDatabase);
}
+ if (g_PVRManager.IsStarted())
+ {
+ CPVRChannel *channel = g_PVRChannelGroups->GetChannelByEpgId(epg->EpgID());
+ if (epg->EpgID() > 0 && !channel)
+ {
+ DeleteEpg(*epg);
+ bReturn = false;
+ }
+ }
+
m_bPreventUpdates = false;
CDateTime::GetCurrentDateTime().GetAsUTCDateTime().GetAsTime(m_iNextEpgUpdate);

0 comments on commit bde8c91

Please sign in to comment.