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["rating"] = m_iStarRating;
208 value["title"] = m_strTitle;
209 value["plotoutline"] = m_strPlotOutline;
210 value["plot"] = m_strPlot;
211 value["genre"] = m_genre;
212 value["filenameandpath"] = m_strFileNameAndPath;
213 value["starttime"] = m_startTime.IsValid() ? m_startTime.GetAsDBDateTime() : StringUtils::EmptyString;
214 value["endtime"] = m_endTime.IsValid() ? m_endTime.GetAsDBDateTime() : StringUtils::EmptyString;
215 value["runtime"] = StringUtils::Format("%d", GetDuration() / 60);
216 value["firstaired"] = m_firstAired.IsValid() ? m_firstAired.GetAsDBDate() : StringUtils::EmptyString;
217 value["progress"] = Progress();
218 value["progresspercentage"] = ProgressPercentage();
219 value["episodename"] = m_strEpisodeName;
220 value["episodenum"] = m_iEpisodeNumber;
221 value["episodepart"] = m_iEpisodePart;
222 value["hastimer"] = HasTimer();
223 value["isactive"] = IsActive();
224 value["wasactive"] = WasActive();
227 bool CEpgInfoTag::Changed(void) const
229 CSingleLock lock(m_critSection);
233 bool CEpgInfoTag::IsActive(void) const
235 CDateTime now = CDateTime::GetUTCDateTime();
236 CSingleLock lock(m_critSection);
237 return (m_startTime <= now && m_endTime > now);
240 bool CEpgInfoTag::WasActive(void) const
242 CDateTime now = CDateTime::GetUTCDateTime();
243 CSingleLock lock(m_critSection);
244 return (m_endTime < now);
247 bool CEpgInfoTag::InTheFuture(void) const
249 CDateTime now = CDateTime::GetUTCDateTime();
250 CSingleLock lock(m_critSection);
251 return (m_startTime > now);
254 float CEpgInfoTag::ProgressPercentage(void) const
258 time_t currentTime, startTime, endTime;
259 CDateTime::GetCurrentDateTime().GetAsUTCDateTime().GetAsTime(currentTime);
261 CSingleLock lock(m_critSection);
262 m_startTime.GetAsTime(startTime);
263 m_endTime.GetAsTime(endTime);
264 iDuration = endTime - startTime > 0 ? endTime - startTime : 3600;
266 if (currentTime >= startTime && currentTime <= endTime)
267 fReturn = ((float) currentTime - startTime) / iDuration * 100;
268 else if (currentTime > endTime)
274 int CEpgInfoTag::Progress(void) const
277 time_t currentTime, startTime;
278 CDateTime::GetCurrentDateTime().GetAsUTCDateTime().GetAsTime(currentTime);
280 CSingleLock lock(m_critSection);
281 m_startTime.GetAsTime(startTime);
282 iDuration = currentTime - startTime;
289 CEpgInfoTagPtr CEpgInfoTag::GetNextEvent(void) const
291 return GetTable()->GetNextEvent(*this);
294 CEpgInfoTagPtr CEpgInfoTag::GetPreviousEvent(void) const
296 return GetTable()->GetPreviousEvent(*this);
299 void CEpgInfoTag::SetUniqueBroadcastID(int iUniqueBroadcastID)
303 CSingleLock lock(m_critSection);
304 if (m_iUniqueBroadcastID != iUniqueBroadcastID)
306 m_iUniqueBroadcastID = iUniqueBroadcastID;
315 int CEpgInfoTag::UniqueBroadcastID(void) const
317 CSingleLock lock(m_critSection);
318 return m_iUniqueBroadcastID;
321 void CEpgInfoTag::SetBroadcastId(int iId)
325 CSingleLock lock(m_critSection);
326 if (m_iBroadcastId != iId)
328 m_iBroadcastId = iId;
337 int CEpgInfoTag::BroadcastId(void) const
339 CSingleLock lock(m_critSection);
340 return m_iBroadcastId;
343 CDateTime CEpgInfoTag::StartAsUTC(void) const
345 CSingleLock lock(m_critSection);
349 CDateTime CEpgInfoTag::StartAsLocalTime(void) const
352 CSingleLock lock(m_critSection);
353 retVal.SetFromUTCDateTime(m_startTime);
357 void CEpgInfoTag::SetStartFromUTC(const CDateTime &start)
361 CSingleLock lock(m_critSection);
362 if (m_startTime != start)
373 void CEpgInfoTag::SetStartFromLocalTime(const CDateTime &start)
375 CDateTime tmp = start.GetAsUTCDateTime();
376 SetStartFromUTC(tmp);
379 CDateTime CEpgInfoTag::EndAsUTC(void) const
382 CSingleLock lock(m_critSection);
387 CDateTime CEpgInfoTag::EndAsLocalTime(void) const
390 CSingleLock lock(m_critSection);
391 retVal.SetFromUTCDateTime(m_endTime);
395 void CEpgInfoTag::SetEndFromUTC(const CDateTime &end)
399 CSingleLock lock(m_critSection);
400 if (m_endTime != end)
411 void CEpgInfoTag::SetEndFromLocalTime(const CDateTime &end)
413 CDateTime tmp = end.GetAsUTCDateTime();
417 int CEpgInfoTag::GetDuration(void) const
420 CSingleLock lock(m_critSection);
421 m_startTime.GetAsTime(start);
422 m_endTime.GetAsTime(end);
423 return end - start > 0 ? end - start : 3600;
426 void CEpgInfoTag::SetTitle(const CStdString &strTitle)
430 CSingleLock lock(m_critSection);
431 if (m_strTitle != strTitle)
433 m_strTitle = strTitle;
442 CStdString CEpgInfoTag::Title(bool bOverrideParental /* = false */) const
445 bool bParentalLocked(false);
448 CSingleLock lock(m_critSection);
449 strTitle = m_strTitle;
451 bParentalLocked = g_PVRManager.IsParentalLocked(*m_pvrChannel);
454 if (!bOverrideParental && bParentalLocked)
455 strTitle = g_localizeStrings.Get(19266); // parental locked
456 else if (strTitle.empty() && !CSettings::Get().GetBool("epg.hidenoinfoavailable"))
457 strTitle = g_localizeStrings.Get(19055); // no information available
462 void CEpgInfoTag::SetPlotOutline(const CStdString &strPlotOutline)
466 CSingleLock lock(m_critSection);
467 if (m_strPlotOutline != strPlotOutline)
469 m_strPlotOutline = strPlotOutline;
478 CStdString CEpgInfoTag::PlotOutline(bool bOverrideParental /* = false */) const
481 CSingleLock lock(m_critSection);
482 if (bOverrideParental || !m_pvrChannel || !g_PVRManager.IsParentalLocked(*m_pvrChannel))
483 retVal = m_strPlotOutline;
488 void CEpgInfoTag::SetPlot(const CStdString &strPlot)
492 CSingleLock lock(m_critSection);
493 bUpdate = !m_strPlot.Equals(strPlot);
494 m_bChanged |= bUpdate;
501 CStdString CEpgInfoTag::Plot(bool bOverrideParental /* = false */) const
504 CSingleLock lock(m_critSection);
505 if (bOverrideParental || !m_pvrChannel || !g_PVRManager.IsParentalLocked(*m_pvrChannel))
511 void CEpgInfoTag::SetGenre(int iID, int iSubID, const char* strGenre)
515 CSingleLock lock(m_critSection);
516 if (m_iGenreType != iID || m_iGenreSubType != iSubID)
519 m_iGenreSubType = iSubID;
520 if ((iID == EPG_GENRE_USE_STRING) && (strGenre != NULL) && (strlen(strGenre) > 0))
522 /* Type and sub type are not given. No EPG color coding possible
523 * Use the provided genre description as backup. */
524 m_genre = StringUtils::Split(strGenre, g_advancedSettings.m_videoItemSeparator);
528 /* Determine the genre description from the type and subtype IDs */
529 m_genre = StringUtils::Split(CEpg::ConvertGenreIdToString(iID, iSubID), g_advancedSettings.m_videoItemSeparator);
539 int CEpgInfoTag::GenreType(void) const
541 CSingleLock lock(m_critSection);
545 int CEpgInfoTag::GenreSubType(void) const
547 CSingleLock lock(m_critSection);
548 return m_iGenreSubType;
551 const vector<string> CEpgInfoTag::Genre(void) const
553 vector<string> retVal;
554 CSingleLock lock(m_critSection);
559 CDateTime CEpgInfoTag::FirstAiredAsUTC(void) const
562 CSingleLock lock(m_critSection);
563 retVal = m_firstAired;
567 CDateTime CEpgInfoTag::FirstAiredAsLocalTime(void) const
570 CSingleLock lock(m_critSection);
571 retVal.SetFromUTCDateTime(m_firstAired);
575 void CEpgInfoTag::SetFirstAiredFromUTC(const CDateTime &firstAired)
579 CSingleLock lock(m_critSection);
580 if (m_firstAired != firstAired)
582 m_firstAired = firstAired;
591 void CEpgInfoTag::SetFirstAiredFromLocalTime(const CDateTime &firstAired)
593 CDateTime tmp = firstAired.GetAsUTCDateTime();
594 SetFirstAiredFromUTC(tmp);
597 void CEpgInfoTag::SetParentalRating(int iParentalRating)
601 CSingleLock lock(m_critSection);
602 if (m_iParentalRating != iParentalRating)
604 m_iParentalRating = iParentalRating;
613 int CEpgInfoTag::ParentalRating(void) const
615 CSingleLock lock(m_critSection);
616 return m_iParentalRating;
619 void CEpgInfoTag::SetStarRating(int iStarRating)
623 CSingleLock lock(m_critSection);
624 if (m_iStarRating != iStarRating)
626 m_iStarRating = iStarRating;
635 int CEpgInfoTag::StarRating(void) const
637 CSingleLock lock(m_critSection);
638 return m_iStarRating;
641 void CEpgInfoTag::SetNotify(bool bNotify)
645 CSingleLock lock(m_critSection);
646 if (m_bNotify != bNotify)
657 bool CEpgInfoTag::Notify(void) const
659 CSingleLock lock(m_critSection);
663 void CEpgInfoTag::SetSeriesNum(int iSeriesNum)
667 CSingleLock lock(m_critSection);
668 if (m_iSeriesNumber != iSeriesNum)
670 m_iSeriesNumber = iSeriesNum;
679 int CEpgInfoTag::SeriesNum(void) const
681 CSingleLock lock(m_critSection);
682 return m_iSeriesNumber;
685 void CEpgInfoTag::SetEpisodeNum(int iEpisodeNum)
689 CSingleLock lock(m_critSection);
690 if (m_iEpisodeNumber != iEpisodeNum)
692 m_iEpisodeNumber = iEpisodeNum;
701 int CEpgInfoTag::EpisodeNum(void) const
703 CSingleLock lock(m_critSection);
704 return m_iEpisodeNumber;
707 void CEpgInfoTag::SetEpisodePart(int iEpisodePart)
711 CSingleLock lock(m_critSection);
712 if (m_iEpisodePart != iEpisodePart)
714 m_iEpisodePart = iEpisodePart;
723 int CEpgInfoTag::EpisodePart(void) const
725 CSingleLock lock(m_critSection);
726 return m_iEpisodePart;
729 void CEpgInfoTag::SetEpisodeName(const CStdString &strEpisodeName)
733 CSingleLock lock(m_critSection);
734 if (m_strEpisodeName != strEpisodeName)
736 m_strEpisodeName = strEpisodeName;
745 CStdString CEpgInfoTag::EpisodeName(void) const
748 CSingleLock lock(m_critSection);
749 retVal = m_strEpisodeName;
753 void CEpgInfoTag::SetIcon(const CStdString &strIconPath)
757 CSingleLock lock(m_critSection);
758 if (m_strIconPath != strIconPath)
760 m_strIconPath = strIconPath;
769 CStdString CEpgInfoTag::Icon(void) const
773 CSingleLock lock(m_critSection);
774 retVal = m_strIconPath;
778 void CEpgInfoTag::SetPath(const CStdString &strFileNameAndPath)
780 CSingleLock lock(m_critSection);
781 if (m_strFileNameAndPath != strFileNameAndPath)
783 m_strFileNameAndPath = strFileNameAndPath;
788 CStdString CEpgInfoTag::Path(void) const
791 CSingleLock lock(m_critSection);
792 retVal = m_strFileNameAndPath;
796 //void CEpgInfoTag::SetTimer(CPVRTimerInfoTagPtr newTimer)
798 // CPVRTimerInfoTagPtr oldTimer;
800 // CSingleLock lock(m_critSection);
801 // oldTimer = m_timer;
802 // m_timer = newTimer;
805 // oldTimer->ClearEpgTag();
808 bool CEpgInfoTag::HasTimer(void) const
810 CSingleLock lock(m_critSection);
811 return m_timer != NULL;
814 CPVRTimerInfoTagPtr CEpgInfoTag::Timer(void) const
816 CSingleLock lock(m_critSection);
820 void CEpgInfoTag::SetPVRChannel(PVR::CPVRChannelPtr channel)
822 CSingleLock lock(m_critSection);
823 m_pvrChannel = channel;
826 bool CEpgInfoTag::HasPVRChannel(void) const
828 CSingleLock lock(m_critSection);
829 return m_pvrChannel != NULL;
832 int CEpgInfoTag::PVRChannelNumber(void) const
834 CSingleLock lock(m_critSection);
835 return m_pvrChannel ? m_pvrChannel->ChannelNumber() : -1;
838 CStdString CEpgInfoTag::PVRChannelName(void) const
840 CStdString strReturn;
841 CSingleLock lock(m_critSection);
843 strReturn = m_pvrChannel->ChannelName();
847 const PVR::CPVRChannelPtr CEpgInfoTag::ChannelTag(void) const
849 CSingleLock lock(m_critSection);
853 void CEpgInfoTag::Update(const EPG_TAG &tag)
855 CSingleLock lock(m_critSection);
856 SetStartFromUTC(tag.startTime + g_advancedSettings.m_iPVRTimeCorrection);
857 SetEndFromUTC(tag.endTime + g_advancedSettings.m_iPVRTimeCorrection);
858 SetTitle(tag.strTitle);
859 SetPlotOutline(tag.strPlotOutline);
860 SetPlot(tag.strPlot);
861 SetGenre(tag.iGenreType, tag.iGenreSubType, tag.strGenreDescription);
862 SetParentalRating(tag.iParentalRating);
863 SetUniqueBroadcastID(tag.iUniqueBroadcastId);
864 SetNotify(tag.bNotify);
865 SetFirstAiredFromUTC(tag.firstAired + g_advancedSettings.m_iPVRTimeCorrection);
866 SetEpisodeNum(tag.iEpisodeNumber);
867 SetEpisodePart(tag.iEpisodePartNumber);
868 SetEpisodeName(tag.strEpisodeName);
869 SetStarRating(tag.iStarRating);
870 SetIcon(tag.strIconPath);
873 bool CEpgInfoTag::Update(const CEpgInfoTag &tag, bool bUpdateBroadcastId /* = true */)
875 bool bChanged(false);
877 CSingleLock lock(m_critSection);
879 m_strTitle != tag.m_strTitle ||
880 m_strPlotOutline != tag.m_strPlotOutline ||
881 m_strPlot != tag.m_strPlot ||
882 m_startTime != tag.m_startTime ||
883 m_endTime != tag.m_endTime ||
884 m_iGenreType != tag.m_iGenreType ||
885 m_iGenreSubType != tag.m_iGenreSubType ||
886 m_firstAired != tag.m_firstAired ||
887 m_iParentalRating != tag.m_iParentalRating ||
888 m_iStarRating != tag.m_iStarRating ||
889 m_bNotify != tag.m_bNotify ||
890 m_iEpisodeNumber != tag.m_iEpisodeNumber ||
891 m_iEpisodePart != tag.m_iEpisodePart ||
892 m_iSeriesNumber != tag.m_iSeriesNumber ||
893 m_strEpisodeName != tag.m_strEpisodeName ||
894 m_iUniqueBroadcastID != tag.m_iUniqueBroadcastID ||
895 EpgID() != tag.EpgID() ||
896 m_pvrChannel != tag.m_pvrChannel ||
897 m_genre != tag.m_genre
899 if (bUpdateBroadcastId)
900 bChanged = bChanged || m_iBroadcastId != tag.m_iBroadcastId;
904 if (bUpdateBroadcastId)
905 m_iBroadcastId = tag.m_iBroadcastId;
907 m_strTitle = tag.m_strTitle;
908 m_strPlotOutline = tag.m_strPlotOutline;
909 m_strPlot = tag.m_strPlot;
910 m_startTime = tag.m_startTime;
911 m_endTime = tag.m_endTime;
912 m_iGenreType = tag.m_iGenreType;
913 m_iGenreSubType = tag.m_iGenreSubType;
915 m_pvrChannel = tag.m_pvrChannel;
916 if (m_iGenreType == EPG_GENRE_USE_STRING)
918 /* No type/subtype. Use the provided description */
919 m_genre = tag.m_genre;
923 /* Determine genre description by type/subtype */
924 m_genre = StringUtils::Split(CEpg::ConvertGenreIdToString(tag.m_iGenreType, tag.m_iGenreSubType), g_advancedSettings.m_videoItemSeparator);
926 m_firstAired = tag.m_firstAired;
927 m_iParentalRating = tag.m_iParentalRating;
928 m_iStarRating = tag.m_iStarRating;
929 m_bNotify = tag.m_bNotify;
930 m_iEpisodeNumber = tag.m_iEpisodeNumber;
931 m_iEpisodePart = tag.m_iEpisodePart;
932 m_iSeriesNumber = tag.m_iSeriesNumber;
933 m_strEpisodeName = tag.m_strEpisodeName;
934 m_iUniqueBroadcastID = tag.m_iUniqueBroadcastID;
945 bool CEpgInfoTag::Persist(bool bSingleUpdate /* = true */)
947 bool bReturn = false;
948 CSingleLock lock(m_critSection);
953 CLog::Log(LOGDEBUG, "Epg - %s - Infotag '%s' %s, persisting...", __FUNCTION__, m_strTitle.c_str(), m_iBroadcastId > 0 ? "has changes" : "is new");
956 CEpgDatabase *database = g_EpgContainer.GetDatabase();
957 if (!database || (bSingleUpdate && !database->IsOpen()))
959 CLog::Log(LOGERROR, "%s - could not open the database", __FUNCTION__);
963 int iId = database->Persist(*this, bSingleUpdate);
970 m_iBroadcastId = iId;
978 void CEpgInfoTag::UpdatePath(void)
982 CSingleLock lock(m_critSection);
983 path = StringUtils::Format("pvr://guide/%04i/%s.epg", EpgID(), m_startTime.GetAsDBDateTime().c_str());
989 const CEpg *CEpgInfoTag::GetTable() const
994 const int CEpgInfoTag::EpgID(void) const
996 return m_epg ? m_epg->EpgID() : -1;
999 void CEpgInfoTag::SetTimer(CPVRTimerInfoTagPtr timer)
1001 CSingleLock lock(m_critSection);
1005 void CEpgInfoTag::ClearTimer(void)
1007 CPVRTimerInfoTagPtr previousTag;
1009 CSingleLock lock(m_critSection);
1010 previousTag = m_timer;
1011 CPVRTimerInfoTagPtr empty;
1016 previousTag->ClearEpgTag();