bool CEpg::UpdateEntry(const CEpgInfoTagPtr &tag, bool bUpdateDatabase /* = false */) { CEpgInfoTagPtr infoTag; { CSingleLock lock(m_critSection); std::map<CDateTime, CEpgInfoTagPtr>::iterator it = m_tags.find(tag->StartAsUTC()); bool bNewTag(false); if (it != m_tags.end()) { infoTag = it->second; } else { infoTag.reset(new CEpgInfoTag(this, m_pvrChannel, m_strName, m_pvrChannel ? m_pvrChannel->IconPath() : "")); infoTag->SetUniqueBroadcastID(tag->UniqueBroadcastID()); m_tags.insert(std::make_pair(tag->StartAsUTC(), infoTag)); bNewTag = true; } infoTag->Update(*tag, bNewTag); infoTag->SetEpg(this); infoTag->SetPVRChannel(m_pvrChannel); if (bUpdateDatabase) m_changedTags.insert(std::make_pair(infoTag->UniqueBroadcastID(), infoTag)); } infoTag->SetTimer(g_PVRTimers->GetTimerForEpgTag(infoTag)); infoTag->SetRecording(g_PVRRecordings->GetRecordingForEpgTag(infoTag)); return true; }
void CEpg::AddEntry(const CEpgInfoTag &tag) { CEpgInfoTagPtr newTag; CPVRChannelPtr channel; { CSingleLock lock(m_critSection); std::map<CDateTime, CEpgInfoTagPtr>::iterator itr = m_tags.find(tag.StartAsUTC()); if (itr != m_tags.end()) newTag = itr->second; else { newTag.reset(new CEpgInfoTag(this, m_pvrChannel, m_strName, m_pvrChannel ? m_pvrChannel->IconPath() : "")); m_tags.insert(make_pair(tag.StartAsUTC(), newTag)); } channel = m_pvrChannel; } if (newTag) { newTag->Update(tag); newTag->SetPVRChannel(channel); newTag->SetEpg(this); newTag->SetTimer(g_PVRTimers->GetTimerForEpgTag(newTag)); newTag->SetRecording(g_PVRRecordings->GetRecordingForEpgTag(newTag)); } }