bool CGUIWindowPVRBase::UpdateEpgForChannel(CFileItem *item) { CPVRChannelPtr channel(item->GetPVRChannelInfoTag()); CEpgPtr epg = channel->GetEPG(); if (!epg) return false; epg->ForceUpdate(); return true; }
void CEpgContainer::Process(void) { time_t iNow(0), iLastSave(0); bool bUpdateEpg(true); bool bHasPendingUpdates(false); while (!m_bStop && !g_application.m_bStop) { CDateTime::GetCurrentDateTime().GetAsUTCDateTime().GetAsTime(iNow); { CSingleLock lock(m_critSection); bUpdateEpg = (iNow >= m_iNextEpgUpdate); } /* update the EPG */ if (!InterruptUpdate() && bUpdateEpg && g_PVRManager.EpgsCreated() && UpdateEPG()) m_bIsInitialising = false; /* clean up old entries */ if (!m_bStop && iNow >= m_iLastEpgCleanup + g_advancedSettings.m_iEpgCleanupInterval) RemoveOldEntries(); /* check for pending manual EPG updates */ while (!m_bStop) { SUpdateRequest request; { CSingleLock lock(m_updateRequestsLock); if (m_updateRequests.empty()) break; request = m_updateRequests.front(); m_updateRequests.pop_front(); } // get the channel CPVRChannelPtr channel = g_PVRChannelGroups->GetByUniqueID(request.channelID, request.clientID); CEpgPtr epg; // get the EPG for the channel if (!channel || !(epg = channel->GetEPG())) { CLog::Log(LOGERROR, "PVR - %s - invalid channel or channel doesn't have an EPG", __FUNCTION__); continue; } // force an update epg->ForceUpdate(); } if (!m_bStop) { { CSingleLock lock(m_critSection); bHasPendingUpdates = (m_pendingUpdates > 0); } if (bHasPendingUpdates) UpdateEPG(true); } /* check for updated active tag */ if (!m_bStop) CheckPlayingEvents(); /* check for changes that need to be saved every 60 seconds */ if (iNow - iLastSave > 60) { PersistAll(); iLastSave = iNow; } Sleep(1000); } }