2 * Copyright (C) 2012-2013 Team XBMC
5 * This Program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2, or (at your option)
10 * This Program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with XBMC; see the file COPYING. If not, see
17 * <http://www.gnu.org/licenses/>.
21 #include "guilib/LocalizeStrings.h"
23 #include "EpgInfoTag.h"
24 #include "EpgContainer.h"
25 #include "EpgDatabase.h"
26 #include "pvr/channels/PVRChannelGroupsContainer.h"
27 #include "pvr/timers/PVRTimers.h"
28 #include "pvr/PVRManager.h"
29 #include "settings/AdvancedSettings.h"
30 #include "settings/Settings.h"
31 #include "utils/log.h"
32 #include "utils/Variant.h"
33 #include "addons/include/xbmc_pvr_types.h"
39 CEpgInfoTag::CEpgInfoTag(void) :
50 m_iUniqueBroadcastID(-1),
53 CPVRChannelPtr emptyChannel;
54 m_pvrChannel = emptyChannel;
56 CPVRTimerInfoTagPtr emptyTimer;
60 CEpgInfoTag::CEpgInfoTag(CEpg *epg, PVR::CPVRChannelPtr pvrChannel, const CStdString &strTableName /* = StringUtils::EmptyString */, const CStdString &strIconPath /* = StringUtils::EmptyString */) :
71 m_iUniqueBroadcastID(-1),
72 m_strIconPath(strIconPath),
74 m_pvrChannel(pvrChannel)
76 CPVRTimerInfoTagPtr emptyTimer;
80 CEpgInfoTag::CEpgInfoTag(const EPG_TAG &data) :
91 m_iUniqueBroadcastID(-1),
94 CPVRChannelPtr emptyChannel;
95 m_pvrChannel = emptyChannel;
97 CPVRTimerInfoTagPtr emptyTimer;
103 CEpgInfoTag::CEpgInfoTag(const CEpgInfoTag &tag) :
104 m_bNotify(tag.m_bNotify),
105 m_bChanged(tag.m_bChanged),
106 m_iBroadcastId(tag.m_iBroadcastId),
107 m_iGenreType(tag.m_iGenreType),
108 m_iGenreSubType(tag.m_iGenreSubType),
109 m_iParentalRating(tag.m_iParentalRating),
110 m_iStarRating(tag.m_iStarRating),
111 m_iSeriesNumber(tag.m_iSeriesNumber),
112 m_iEpisodeNumber(tag.m_iEpisodeNumber),
113 m_iEpisodePart(tag.m_iEpisodePart),
114 m_iUniqueBroadcastID(tag.m_iUniqueBroadcastID),
115 m_strTitle(tag.m_strTitle),
116 m_strPlotOutline(tag.m_strPlotOutline),
117 m_strPlot(tag.m_strPlot),
118 m_genre(tag.m_genre),
119 m_strEpisodeName(tag.m_strEpisodeName),
120 m_strIconPath(tag.m_strIconPath),
121 m_strFileNameAndPath(tag.m_strFileNameAndPath),
122 m_startTime(tag.m_startTime),
123 m_endTime(tag.m_endTime),
124 m_firstAired(tag.m_firstAired),
125 m_timer(tag.m_timer),
127 m_pvrChannel(tag.m_pvrChannel)
131 CEpgInfoTag::~CEpgInfoTag()
136 bool CEpgInfoTag::operator ==(const CEpgInfoTag& right) const
138 if (this == &right) return true;
140 CSingleLock lock(m_critSection);
141 return (m_bNotify == right.m_bNotify &&
142 m_bChanged == right.m_bChanged &&
143 m_iBroadcastId == right.m_iBroadcastId &&
144 m_iGenreType == right.m_iGenreType &&
145 m_iGenreSubType == right.m_iGenreSubType &&
146 m_iParentalRating == right.m_iParentalRating &&
147 m_firstAired == right.m_firstAired &&
148 m_iStarRating == right.m_iStarRating &&
149 m_iSeriesNumber == right.m_iSeriesNumber &&
150 m_iEpisodeNumber == right.m_iEpisodeNumber &&
151 m_iEpisodePart == right.m_iEpisodePart &&
152 m_iUniqueBroadcastID == right.m_iUniqueBroadcastID &&
153 m_strTitle == right.m_strTitle &&
154 m_strPlotOutline == right.m_strPlotOutline &&
155 m_strPlot == right.m_strPlot &&
156 m_genre == right.m_genre &&
157 m_strEpisodeName == right.m_strEpisodeName &&
158 m_strIconPath == right.m_strIconPath &&
159 m_strFileNameAndPath == right.m_strFileNameAndPath &&
160 m_startTime == right.m_startTime &&
161 m_endTime == right.m_endTime &&
162 m_pvrChannel == right.m_pvrChannel);
165 bool CEpgInfoTag::operator !=(const CEpgInfoTag& right) const
167 if (this == &right) return false;
169 return !(*this == right);
172 CEpgInfoTag &CEpgInfoTag::operator =(const CEpgInfoTag &other)
174 CSingleLock lock(other.m_critSection);
176 m_bNotify = other.m_bNotify;
177 m_bChanged = other.m_bChanged;
178 m_iBroadcastId = other.m_iBroadcastId;
179 m_iGenreType = other.m_iGenreType;
180 m_iGenreSubType = other.m_iGenreSubType;
181 m_iParentalRating = other.m_iParentalRating;
182 m_iStarRating = other.m_iStarRating;
183 m_iSeriesNumber = other.m_iSeriesNumber;
184 m_iEpisodeNumber = other.m_iEpisodeNumber;
185 m_iEpisodePart = other.m_iEpisodePart;
186 m_iUniqueBroadcastID = other.m_iUniqueBroadcastID;
187 m_strTitle = other.m_strTitle;
188 m_strPlotOutline = other.m_strPlotOutline;
189 m_strPlot = other.m_strPlot;
190 m_genre = other.m_genre;
191 m_strEpisodeName = other.m_strEpisodeName;
192 m_strIconPath = other.m_strIconPath;
193 m_strFileNameAndPath = other.m_strFileNameAndPath;
194 m_startTime = other.m_startTime;
195 m_endTime = other.m_endTime;
196 m_firstAired = other.m_firstAired;
197 m_timer = other.m_timer;
199 m_pvrChannel = other.m_pvrChannel;
204 void CEpgInfoTag::Serialize(CVariant &value) const
206 value["broadcastid"] = m_iUniqueBroadcastID;
207 value["parentalrating"] = m_iParentalRating;
208 value["rating"] = m_iStarRating;
209 value["title"] = m_strTitle;
210 value["plotoutline"] = m_strPlotOutline;
211 value["plot"] = m_strPlot;
212 value["genre"] = m_genre;
213 value["filenameandpath"] = m_strFileNameAndPath;
214 value["starttime"] = m_startTime.IsValid() ? m_startTime.GetAsDBDateTime() : StringUtils::EmptyString;
215 value["endtime"] = m_endTime.IsValid() ? m_endTime.GetAsDBDateTime() : StringUtils::EmptyString;
216 value["runtime"] = StringUtils::Format("%d", GetDuration() / 60);
217 value["firstaired"] = m_firstAired.IsValid() ? m_firstAired.GetAsDBDate() : StringUtils::EmptyString;
218 value["progress"] = Progress();
219 value["progresspercentage"] = ProgressPercentage();
220 value["episodename"] = m_strEpisodeName;
221 value["episodenum"] = m_iEpisodeNumber;
222 value["episodepart"] = m_iEpisodePart;
223 value["hastimer"] = HasTimer();
224 value["isactive"] = IsActive();
225 value["wasactive"] = WasActive();
228 bool CEpgInfoTag::Changed(void) const
230 CSingleLock lock(m_critSection);
234 bool CEpgInfoTag::IsActive(void) const
236 CDateTime now = CDateTime::GetUTCDateTime();
237 CSingleLock lock(m_critSection);
238 return (m_startTime <= now && m_endTime > now);
241 bool CEpgInfoTag::WasActive(void) const
243 CDateTime now = CDateTime::GetUTCDateTime();
244 CSingleLock lock(m_critSection);
245 return (m_endTime < now);
248 bool CEpgInfoTag::InTheFuture(void) const
250 CDateTime now = CDateTime::GetUTCDateTime();
251 CSingleLock lock(m_critSection);
252 return (m_startTime > now);
255 float CEpgInfoTag::ProgressPercentage(void) const
259 time_t currentTime, startTime, endTime;
260 CDateTime::GetCurrentDateTime().GetAsUTCDateTime().GetAsTime(currentTime);
262 CSingleLock lock(m_critSection);
263 m_startTime.GetAsTime(startTime);
264 m_endTime.GetAsTime(endTime);
265 iDuration = endTime - startTime > 0 ? endTime - startTime : 3600;
267 if (currentTime >= startTime && currentTime <= endTime)
268 fReturn = ((float) currentTime - startTime) / iDuration * 100;
269 else if (currentTime > endTime)
275 int CEpgInfoTag::Progress(void) const
278 time_t currentTime, startTime;
279 CDateTime::GetCurrentDateTime().GetAsUTCDateTime().GetAsTime(currentTime);
281 CSingleLock lock(m_critSection);
282 m_startTime.GetAsTime(startTime);
283 iDuration = currentTime - startTime;
290 CEpgInfoTagPtr CEpgInfoTag::GetNextEvent(void) const
292 return GetTable()->GetNextEvent(*this);
295 CEpgInfoTagPtr CEpgInfoTag::GetPreviousEvent(void) const
297 return GetTable()->GetPreviousEvent(*this);
300 void CEpgInfoTag::SetUniqueBroadcastID(int iUniqueBroadcastID)
304 CSingleLock lock(m_critSection);
305 if (m_iUniqueBroadcastID != iUniqueBroadcastID)
307 m_iUniqueBroadcastID = iUniqueBroadcastID;
316 int CEpgInfoTag::UniqueBroadcastID(void) const
318 CSingleLock lock(m_critSection);
319 return m_iUniqueBroadcastID;
322 void CEpgInfoTag::SetBroadcastId(int iId)
326 CSingleLock lock(m_critSection);
327 if (m_iBroadcastId != iId)
329 m_iBroadcastId = iId;
338 int CEpgInfoTag::BroadcastId(void) const
340 CSingleLock lock(m_critSection);
341 return m_iBroadcastId;
344 CDateTime CEpgInfoTag::StartAsUTC(void) const
346 CSingleLock lock(m_critSection);
350 CDateTime CEpgInfoTag::StartAsLocalTime(void) const
353 CSingleLock lock(m_critSection);
354 retVal.SetFromUTCDateTime(m_startTime);
358 void CEpgInfoTag::SetStartFromUTC(const CDateTime &start)
362 CSingleLock lock(m_critSection);
363 if (m_startTime != start)
374 void CEpgInfoTag::SetStartFromLocalTime(const CDateTime &start)
376 CDateTime tmp = start.GetAsUTCDateTime();
377 SetStartFromUTC(tmp);
380 CDateTime CEpgInfoTag::EndAsUTC(void) const
383 CSingleLock lock(m_critSection);
388 CDateTime CEpgInfoTag::EndAsLocalTime(void) const
391 CSingleLock lock(m_critSection);
392 retVal.SetFromUTCDateTime(m_endTime);
396 void CEpgInfoTag::SetEndFromUTC(const CDateTime &end)
400 CSingleLock lock(m_critSection);
401 if (m_endTime != end)
412 void CEpgInfoTag::SetEndFromLocalTime(const CDateTime &end)
414 CDateTime tmp = end.GetAsUTCDateTime();
418 int CEpgInfoTag::GetDuration(void) const
421 CSingleLock lock(m_critSection);
422 m_startTime.GetAsTime(start);
423 m_endTime.GetAsTime(end);
424 return end - start > 0 ? end - start : 3600;
427 void CEpgInfoTag::SetTitle(const CStdString &strTitle)
431 CSingleLock lock(m_critSection);
432 if (m_strTitle != strTitle)
434 m_strTitle = strTitle;
443 CStdString CEpgInfoTag::Title(bool bOverrideParental /* = false */) const
446 bool bParentalLocked(false);
449 CSingleLock lock(m_critSection);
450 strTitle = m_strTitle;
452 bParentalLocked = g_PVRManager.IsParentalLocked(*m_pvrChannel);
455 if (!bOverrideParental && bParentalLocked)
456 strTitle = g_localizeStrings.Get(19266); // parental locked
457 else if (strTitle.empty() && !CSettings::Get().GetBool("epg.hidenoinfoavailable"))
458 strTitle = g_localizeStrings.Get(19055); // no information available
463 void CEpgInfoTag::SetPlotOutline(const CStdString &strPlotOutline)
467 CSingleLock lock(m_critSection);
468 if (m_strPlotOutline != strPlotOutline)
470 m_strPlotOutline = strPlotOutline;
479 CStdString CEpgInfoTag::PlotOutline(bool bOverrideParental /* = false */) const
482 CSingleLock lock(m_critSection);
483 if (bOverrideParental || !m_pvrChannel || !g_PVRManager.IsParentalLocked(*m_pvrChannel))
484 retVal = m_strPlotOutline;
489 void CEpgInfoTag::SetPlot(const CStdString &strPlot)
493 CSingleLock lock(m_critSection);
494 bUpdate = !m_strPlot.Equals(strPlot);
495 m_bChanged |= bUpdate;
502 CStdString CEpgInfoTag::Plot(bool bOverrideParental /* = false */) const
505 CSingleLock lock(m_critSection);
506 if (bOverrideParental || !m_pvrChannel || !g_PVRManager.IsParentalLocked(*m_pvrChannel))
512 void CEpgInfoTag::SetGenre(int iID, int iSubID, const char* strGenre)
516 CSingleLock lock(m_critSection);
517 if (m_iGenreType != iID || m_iGenreSubType != iSubID)
520 m_iGenreSubType = iSubID;
521 if ((iID == EPG_GENRE_USE_STRING) && (strGenre != NULL) && (strlen(strGenre) > 0))
523 /* Type and sub type are not given. No EPG color coding possible
524 * Use the provided genre description as backup. */
525 m_genre = StringUtils::Split(strGenre, g_advancedSettings.m_videoItemSeparator);
529 /* Determine the genre description from the type and subtype IDs */
530 m_genre = StringUtils::Split(CEpg::ConvertGenreIdToString(iID, iSubID), g_advancedSettings.m_videoItemSeparator);
540 int CEpgInfoTag::GenreType(void) const
542 CSingleLock lock(m_critSection);
546 int CEpgInfoTag::GenreSubType(void) const
548 CSingleLock lock(m_critSection);
549 return m_iGenreSubType;
552 const vector<string> CEpgInfoTag::Genre(void) const
554 vector<string> retVal;
555 CSingleLock lock(m_critSection);
560 CDateTime CEpgInfoTag::FirstAiredAsUTC(void) const
563 CSingleLock lock(m_critSection);
564 retVal = m_firstAired;
568 CDateTime CEpgInfoTag::FirstAiredAsLocalTime(void) const
571 CSingleLock lock(m_critSection);
572 retVal.SetFromUTCDateTime(m_firstAired);
576 void CEpgInfoTag::SetFirstAiredFromUTC(const CDateTime &firstAired)
580 CSingleLock lock(m_critSection);
581 if (m_firstAired != firstAired)
583 m_firstAired = firstAired;
592 void CEpgInfoTag::SetFirstAiredFromLocalTime(const CDateTime &firstAired)
594 CDateTime tmp = firstAired.GetAsUTCDateTime();
595 SetFirstAiredFromUTC(tmp);
598 void CEpgInfoTag::SetParentalRating(int iParentalRating)
602 CSingleLock lock(m_critSection);
603 if (m_iParentalRating != iParentalRating)
605 m_iParentalRating = iParentalRating;
614 int CEpgInfoTag::ParentalRating(void) const
616 CSingleLock lock(m_critSection);
617 return m_iParentalRating;
620 void CEpgInfoTag::SetStarRating(int iStarRating)
624 CSingleLock lock(m_critSection);
625 if (m_iStarRating != iStarRating)
627 m_iStarRating = iStarRating;
636 int CEpgInfoTag::StarRating(void) const
638 CSingleLock lock(m_critSection);
639 return m_iStarRating;
642 void CEpgInfoTag::SetNotify(bool bNotify)
646 CSingleLock lock(m_critSection);
647 if (m_bNotify != bNotify)
658 bool CEpgInfoTag::Notify(void) const
660 CSingleLock lock(m_critSection);
664 void CEpgInfoTag::SetSeriesNum(int iSeriesNum)
668 CSingleLock lock(m_critSection);
669 if (m_iSeriesNumber != iSeriesNum)
671 m_iSeriesNumber = iSeriesNum;
680 int CEpgInfoTag::SeriesNum(void) const
682 CSingleLock lock(m_critSection);
683 return m_iSeriesNumber;
686 void CEpgInfoTag::SetEpisodeNum(int iEpisodeNum)
690 CSingleLock lock(m_critSection);
691 if (m_iEpisodeNumber != iEpisodeNum)
693 m_iEpisodeNumber = iEpisodeNum;
702 int CEpgInfoTag::EpisodeNum(void) const
704 CSingleLock lock(m_critSection);
705 return m_iEpisodeNumber;
708 void CEpgInfoTag::SetEpisodePart(int iEpisodePart)
712 CSingleLock lock(m_critSection);
713 if (m_iEpisodePart != iEpisodePart)
715 m_iEpisodePart = iEpisodePart;
724 int CEpgInfoTag::EpisodePart(void) const
726 CSingleLock lock(m_critSection);
727 return m_iEpisodePart;
730 void CEpgInfoTag::SetEpisodeName(const CStdString &strEpisodeName)
734 CSingleLock lock(m_critSection);
735 if (m_strEpisodeName != strEpisodeName)
737 m_strEpisodeName = strEpisodeName;
746 CStdString CEpgInfoTag::EpisodeName(void) const
749 CSingleLock lock(m_critSection);
750 retVal = m_strEpisodeName;
754 void CEpgInfoTag::SetIcon(const CStdString &strIconPath)
758 CSingleLock lock(m_critSection);
759 if (m_strIconPath != strIconPath)
761 m_strIconPath = strIconPath;
770 CStdString CEpgInfoTag::Icon(void) const
774 CSingleLock lock(m_critSection);
775 retVal = m_strIconPath;
779 void CEpgInfoTag::SetPath(const CStdString &strFileNameAndPath)
781 CSingleLock lock(m_critSection);
782 if (m_strFileNameAndPath != strFileNameAndPath)
784 m_strFileNameAndPath = strFileNameAndPath;
789 CStdString CEpgInfoTag::Path(void) const
792 CSingleLock lock(m_critSection);
793 retVal = m_strFileNameAndPath;
797 //void CEpgInfoTag::SetTimer(CPVRTimerInfoTagPtr newTimer)
799 // CPVRTimerInfoTagPtr oldTimer;
801 // CSingleLock lock(m_critSection);
802 // oldTimer = m_timer;
803 // m_timer = newTimer;
806 // oldTimer->ClearEpgTag();
809 bool CEpgInfoTag::HasTimer(void) const
811 CSingleLock lock(m_critSection);
812 return m_timer != NULL;
815 CPVRTimerInfoTagPtr CEpgInfoTag::Timer(void) const
817 CSingleLock lock(m_critSection);
821 void CEpgInfoTag::SetPVRChannel(PVR::CPVRChannelPtr channel)
823 CSingleLock lock(m_critSection);
824 m_pvrChannel = channel;
827 bool CEpgInfoTag::HasPVRChannel(void) const
829 CSingleLock lock(m_critSection);
830 return m_pvrChannel != NULL;
833 int CEpgInfoTag::PVRChannelNumber(void) const
835 CSingleLock lock(m_critSection);
836 return m_pvrChannel ? m_pvrChannel->ChannelNumber() : -1;
839 CStdString CEpgInfoTag::PVRChannelName(void) const
841 CStdString strReturn;
842 CSingleLock lock(m_critSection);
844 strReturn = m_pvrChannel->ChannelName();
848 const PVR::CPVRChannelPtr CEpgInfoTag::ChannelTag(void) const
850 CSingleLock lock(m_critSection);
854 void CEpgInfoTag::Update(const EPG_TAG &tag)
856 CSingleLock lock(m_critSection);
857 SetStartFromUTC(tag.startTime + g_advancedSettings.m_iPVRTimeCorrection);
858 SetEndFromUTC(tag.endTime + g_advancedSettings.m_iPVRTimeCorrection);
859 SetTitle(tag.strTitle);
860 SetPlotOutline(tag.strPlotOutline);
861 SetPlot(tag.strPlot);
862 SetGenre(tag.iGenreType, tag.iGenreSubType, tag.strGenreDescription);
863 SetParentalRating(tag.iParentalRating);
864 SetUniqueBroadcastID(tag.iUniqueBroadcastId);
865 SetNotify(tag.bNotify);
866 SetFirstAiredFromUTC(tag.firstAired + g_advancedSettings.m_iPVRTimeCorrection);
867 SetEpisodeNum(tag.iEpisodeNumber);
868 SetEpisodePart(tag.iEpisodePartNumber);
869 SetEpisodeName(tag.strEpisodeName);
870 SetStarRating(tag.iStarRating);
871 SetIcon(tag.strIconPath);
874 bool CEpgInfoTag::Update(const CEpgInfoTag &tag, bool bUpdateBroadcastId /* = true */)
876 bool bChanged(false);
878 CSingleLock lock(m_critSection);
880 m_strTitle != tag.m_strTitle ||
881 m_strPlotOutline != tag.m_strPlotOutline ||
882 m_strPlot != tag.m_strPlot ||
883 m_startTime != tag.m_startTime ||
884 m_endTime != tag.m_endTime ||
885 m_iGenreType != tag.m_iGenreType ||
886 m_iGenreSubType != tag.m_iGenreSubType ||
887 m_firstAired != tag.m_firstAired ||
888 m_iParentalRating != tag.m_iParentalRating ||
889 m_iStarRating != tag.m_iStarRating ||
890 m_bNotify != tag.m_bNotify ||
891 m_iEpisodeNumber != tag.m_iEpisodeNumber ||
892 m_iEpisodePart != tag.m_iEpisodePart ||
893 m_iSeriesNumber != tag.m_iSeriesNumber ||
894 m_strEpisodeName != tag.m_strEpisodeName ||
895 m_iUniqueBroadcastID != tag.m_iUniqueBroadcastID ||
896 EpgID() != tag.EpgID() ||
897 m_pvrChannel != tag.m_pvrChannel ||
898 m_genre != tag.m_genre
900 if (bUpdateBroadcastId)
901 bChanged = bChanged || m_iBroadcastId != tag.m_iBroadcastId;
905 if (bUpdateBroadcastId)
906 m_iBroadcastId = tag.m_iBroadcastId;
908 m_strTitle = tag.m_strTitle;
909 m_strPlotOutline = tag.m_strPlotOutline;
910 m_strPlot = tag.m_strPlot;
911 m_startTime = tag.m_startTime;
912 m_endTime = tag.m_endTime;
913 m_iGenreType = tag.m_iGenreType;
914 m_iGenreSubType = tag.m_iGenreSubType;
916 m_pvrChannel = tag.m_pvrChannel;
917 if (m_iGenreType == EPG_GENRE_USE_STRING)
919 /* No type/subtype. Use the provided description */
920 m_genre = tag.m_genre;
924 /* Determine genre description by type/subtype */
925 m_genre = StringUtils::Split(CEpg::ConvertGenreIdToString(tag.m_iGenreType, tag.m_iGenreSubType), g_advancedSettings.m_videoItemSeparator);
927 m_firstAired = tag.m_firstAired;
928 m_iParentalRating = tag.m_iParentalRating;
929 m_iStarRating = tag.m_iStarRating;
930 m_bNotify = tag.m_bNotify;
931 m_iEpisodeNumber = tag.m_iEpisodeNumber;
932 m_iEpisodePart = tag.m_iEpisodePart;
933 m_iSeriesNumber = tag.m_iSeriesNumber;
934 m_strEpisodeName = tag.m_strEpisodeName;
935 m_iUniqueBroadcastID = tag.m_iUniqueBroadcastID;
946 bool CEpgInfoTag::Persist(bool bSingleUpdate /* = true */)
948 bool bReturn = false;
949 CSingleLock lock(m_critSection);
954 CLog::Log(LOGDEBUG, "Epg - %s - Infotag '%s' %s, persisting...", __FUNCTION__, m_strTitle.c_str(), m_iBroadcastId > 0 ? "has changes" : "is new");
957 CEpgDatabase *database = g_EpgContainer.GetDatabase();
958 if (!database || (bSingleUpdate && !database->IsOpen()))
960 CLog::Log(LOGERROR, "%s - could not open the database", __FUNCTION__);
964 int iId = database->Persist(*this, bSingleUpdate);
971 m_iBroadcastId = iId;
979 void CEpgInfoTag::UpdatePath(void)
983 CSingleLock lock(m_critSection);
984 path = StringUtils::Format("pvr://guide/%04i/%s.epg", EpgID(), m_startTime.GetAsDBDateTime().c_str());
990 const CEpg *CEpgInfoTag::GetTable() const
995 const int CEpgInfoTag::EpgID(void) const
997 return m_epg ? m_epg->EpgID() : -1;
1000 void CEpgInfoTag::SetTimer(CPVRTimerInfoTagPtr timer)
1002 CSingleLock lock(m_critSection);
1006 void CEpgInfoTag::ClearTimer(void)
1008 CPVRTimerInfoTagPtr previousTag;
1010 CSingleLock lock(m_critSection);
1011 previousTag = m_timer;
1012 CPVRTimerInfoTagPtr empty;
1017 previousTag->ClearEpgTag();