diff --git a/xbmc/epg/Epg.cpp b/xbmc/epg/Epg.cpp index f688bf826496c..e8a6397f0b40c 100644 --- a/xbmc/epg/Epg.cpp +++ b/xbmc/epg/Epg.cpp @@ -226,7 +226,7 @@ CEpgInfoTagPtr CEpg::GetTagNext() const /* return the first event that is in the future */ for (map::const_iterator it = m_tags.begin(); it != m_tags.end(); ++it) { - if (it->second->InTheFuture()) + if (it->second->IsUpcoming()) return it->second; } } @@ -302,9 +302,8 @@ void CEpg::AddEntry(const CEpgInfoTag &tag) { newTag->Update(tag); newTag->SetPVRChannel(m_pvrChannel); - newTag->m_epg = this; + newTag->SetEpg(this); UpdateRecording(newTag); - newTag->m_bChanged = false; } } @@ -328,7 +327,7 @@ bool CEpg::UpdateEntry(const CEpgInfoTag &tag, bool bUpdateDatabase /* = false * } infoTag->Update(tag, bNewTag); - infoTag->m_epg = this; + infoTag->SetEpg(this); infoTag->SetPVRChannel(m_pvrChannel); UpdateRecording(infoTag); diff --git a/xbmc/epg/Epg.h b/xbmc/epg/Epg.h index 080bcec4f7070..c3fdcab4cc4a5 100644 --- a/xbmc/epg/Epg.h +++ b/xbmc/epg/Epg.h @@ -40,7 +40,6 @@ namespace EPG class CEpg : public Observable { friend class CEpgDatabase; - friend class CEpgInfoTag; public: /*! diff --git a/xbmc/epg/EpgDatabase.cpp b/xbmc/epg/EpgDatabase.cpp index 3a8a186cd1a77..dd30feacee313 100644 --- a/xbmc/epg/EpgDatabase.cpp +++ b/xbmc/epg/EpgDatabase.cpp @@ -345,7 +345,7 @@ int CEpgDatabase::Persist(const CEpgInfoTag &tag, bool bSingleUpdate /* = true * tag.EpgID(), iStartTime, iEndTime, tag.Title(true).c_str(), tag.PlotOutline(true).c_str(), tag.Plot(true).c_str(), tag.Icon().c_str(), tag.GenreType(), tag.GenreSubType(), strGenre.c_str(), iFirstAired, tag.ParentalRating(), tag.StarRating(), tag.Notify(), - tag.SeriesNum(), tag.EpisodeNum(), tag.EpisodePart(), tag.EpisodeName().c_str(), + tag.SeriesNumber(), tag.EpisodeNumber(), tag.EpisodePart(), tag.EpisodeName().c_str(), tag.UniqueBroadcastID(), tag.RecordingId().c_str()); } else @@ -358,7 +358,7 @@ int CEpgDatabase::Persist(const CEpgInfoTag &tag, bool bSingleUpdate /* = true * tag.EpgID(), iStartTime, iEndTime, tag.Title(true).c_str(), tag.PlotOutline(true).c_str(), tag.Plot(true).c_str(), tag.Icon().c_str(), tag.GenreType(), tag.GenreSubType(), strGenre.c_str(), iFirstAired, tag.ParentalRating(), tag.StarRating(), tag.Notify(), - tag.SeriesNum(), tag.EpisodeNum(), tag.EpisodePart(), tag.EpisodeName().c_str(), + tag.SeriesNumber(), tag.EpisodeNumber(), tag.EpisodePart(), tag.EpisodeName().c_str(), tag.UniqueBroadcastID(), iBroadcastId, tag.RecordingId().c_str()); } diff --git a/xbmc/epg/EpgInfoTag.cpp b/xbmc/epg/EpgInfoTag.cpp index bd8b490b189e7..4755b38cb4ad4 100644 --- a/xbmc/epg/EpgInfoTag.cpp +++ b/xbmc/epg/EpgInfoTag.cpp @@ -45,7 +45,6 @@ CEpgInfoTagPtr CEpgInfoTag::CreateDefaultTag() CEpgInfoTag::CEpgInfoTag(void) : m_bNotify(false), - m_bChanged(false), m_iBroadcastId(-1), m_iGenreType(0), m_iGenreSubType(0), @@ -61,7 +60,6 @@ CEpgInfoTag::CEpgInfoTag(void) : CEpgInfoTag::CEpgInfoTag(CEpg *epg, PVR::CPVRChannelPtr pvrChannel, const std::string &strTableName /* = "" */, const std::string &strIconPath /* = "" */) : m_bNotify(false), - m_bChanged(false), m_iBroadcastId(-1), m_iGenreType(0), m_iGenreSubType(0), @@ -75,11 +73,11 @@ CEpgInfoTag::CEpgInfoTag(CEpg *epg, PVR::CPVRChannelPtr pvrChannel, const std::s m_epg(epg), m_pvrChannel(pvrChannel) { + UpdatePath(); } CEpgInfoTag::CEpgInfoTag(const EPG_TAG &data) : m_bNotify(false), - m_bChanged(false), m_iBroadcastId(-1), m_iGenreType(0), m_iGenreSubType(0), @@ -91,30 +89,34 @@ CEpgInfoTag::CEpgInfoTag(const EPG_TAG &data) : m_iUniqueBroadcastID(-1), m_epg(NULL) { - SetStartFromUTC(data.startTime + g_advancedSettings.m_iPVRTimeCorrection); - SetEndFromUTC(data.endTime + g_advancedSettings.m_iPVRTimeCorrection); + m_startTime = (data.startTime + g_advancedSettings.m_iPVRTimeCorrection); + m_endTime = (data.endTime + g_advancedSettings.m_iPVRTimeCorrection); + m_iParentalRating = data.iParentalRating; + m_iUniqueBroadcastID = data.iUniqueBroadcastId; + m_bNotify = data.bNotify; + m_firstAired = (data.firstAired + g_advancedSettings.m_iPVRTimeCorrection); + m_iSeriesNumber = data.iSeriesNumber; + m_iEpisodeNumber = data.iEpisodeNumber; + m_iEpisodePart = data.iEpisodePartNumber; + m_iStarRating = data.iStarRating; + SetGenre(data.iGenreType, data.iGenreSubType, data.strGenreDescription); - SetParentalRating(data.iParentalRating); - SetUniqueBroadcastID(data.iUniqueBroadcastId); - SetNotify(data.bNotify); - SetFirstAiredFromUTC(data.firstAired + g_advancedSettings.m_iPVRTimeCorrection); - SetEpisodeNum(data.iEpisodeNumber); - SetEpisodePart(data.iEpisodePartNumber); - SetStarRating(data.iStarRating); // explicit NULL check, because there is no implicit NULL constructor for std::string if (data.strTitle) - SetTitle(data.strTitle); + m_strTitle = data.strTitle; if (data.strPlotOutline) - SetPlotOutline(data.strPlotOutline); + m_strPlotOutline = data.strPlotOutline; if (data.strPlot) - SetPlot(data.strPlot); + m_strPlot = data.strPlot; if (data.strEpisodeName) - SetEpisodeName(data.strEpisodeName); + m_strEpisodeName = data.strEpisodeName; if (data.strIconPath) - SetIcon(data.strIconPath); + m_strIconPath = data.strIconPath; if (data.strRecordingId) - SetRecordingId(data.strRecordingId); + m_strRecordingId = data.strRecordingId; + + UpdatePath(); } CEpgInfoTag::~CEpgInfoTag() @@ -127,9 +129,7 @@ bool CEpgInfoTag::operator ==(const CEpgInfoTag& right) const { if (this == &right) return true; - CSingleLock lock(m_critSection); return (m_bNotify == right.m_bNotify && - m_bChanged == right.m_bChanged && m_iBroadcastId == right.m_iBroadcastId && m_iGenreType == right.m_iGenreType && m_iGenreSubType == right.m_iGenreSubType && @@ -186,12 +186,6 @@ void CEpgInfoTag::Serialize(CVariant &value) const value["wasactive"] = WasActive(); } -bool CEpgInfoTag::Changed(void) const -{ - CSingleLock lock(m_critSection); - return m_bChanged; -} - CDateTime CEpgInfoTag::GetCurrentPlayingTime() const { CDateTime now = CDateTime::GetUTCDateTime(); @@ -210,21 +204,18 @@ CDateTime CEpgInfoTag::GetCurrentPlayingTime() const bool CEpgInfoTag::IsActive(void) const { CDateTime now = GetCurrentPlayingTime(); - CSingleLock lock(m_critSection); return (m_startTime <= now && m_endTime > now); } bool CEpgInfoTag::WasActive(void) const { CDateTime now = GetCurrentPlayingTime(); - CSingleLock lock(m_critSection); return (m_endTime < now); } -bool CEpgInfoTag::InTheFuture(void) const +bool CEpgInfoTag::IsUpcoming(void) const { CDateTime now = GetCurrentPlayingTime(); - CSingleLock lock(m_critSection); return (m_startTime > now); } @@ -235,7 +226,6 @@ float CEpgInfoTag::ProgressPercentage(void) const time_t currentTime, startTime, endTime; CDateTime::GetCurrentDateTime().GetAsUTCDateTime().GetAsTime(currentTime); - CSingleLock lock(m_critSection); m_startTime.GetAsTime(startTime); m_endTime.GetAsTime(endTime); iDuration = endTime - startTime > 0 ? endTime - startTime : 3600; @@ -254,7 +244,6 @@ int CEpgInfoTag::Progress(void) const time_t currentTime, startTime; CDateTime::GetCurrentDateTime().GetAsUTCDateTime().GetAsTime(currentTime); - CSingleLock lock(m_critSection); m_startTime.GetAsTime(startTime); iDuration = currentTime - startTime; if (iDuration <= 0) @@ -275,570 +264,222 @@ CEpgInfoTagPtr CEpgInfoTag::GetPreviousEvent(void) const void CEpgInfoTag::SetUniqueBroadcastID(int iUniqueBroadcastID) { - bool bUpdate(false); - { - CSingleLock lock(m_critSection); - if (m_iUniqueBroadcastID != iUniqueBroadcastID) - { - m_iUniqueBroadcastID = iUniqueBroadcastID; - m_bChanged = true; - bUpdate = true; - } - } - if (bUpdate) - UpdatePath(); + m_iUniqueBroadcastID = iUniqueBroadcastID; } int CEpgInfoTag::UniqueBroadcastID(void) const { - CSingleLock lock(m_critSection); return m_iUniqueBroadcastID; } -void CEpgInfoTag::SetBroadcastId(int iId) -{ - bool bUpdate(false); - { - CSingleLock lock(m_critSection); - if (m_iBroadcastId != iId) - { - m_iBroadcastId = iId; - m_bChanged = true; - bUpdate = true; - } - } - if (bUpdate) - UpdatePath(); -} - int CEpgInfoTag::BroadcastId(void) const { - CSingleLock lock(m_critSection); return m_iBroadcastId; } CDateTime CEpgInfoTag::StartAsUTC(void) const { - CSingleLock lock(m_critSection); return m_startTime; } CDateTime CEpgInfoTag::StartAsLocalTime(void) const { CDateTime retVal; - CSingleLock lock(m_critSection); retVal.SetFromUTCDateTime(m_startTime); return retVal; } -void CEpgInfoTag::SetStartFromUTC(const CDateTime &start) -{ - bool bUpdate(false); - { - CSingleLock lock(m_critSection); - if (m_startTime != start) - { - m_startTime = start; - m_bChanged = true; - bUpdate = true; - } - } - if (bUpdate) - UpdatePath(); -} - -void CEpgInfoTag::SetStartFromLocalTime(const CDateTime &start) -{ - CDateTime tmp = start.GetAsUTCDateTime(); - SetStartFromUTC(tmp); -} - CDateTime CEpgInfoTag::EndAsUTC(void) const { - CDateTime retVal; - CSingleLock lock(m_critSection); - retVal = m_endTime; - return retVal; + return m_endTime; } CDateTime CEpgInfoTag::EndAsLocalTime(void) const { CDateTime retVal; - CSingleLock lock(m_critSection); retVal.SetFromUTCDateTime(m_endTime); return retVal; } void CEpgInfoTag::SetEndFromUTC(const CDateTime &end) { - bool bUpdate(false); - { - CSingleLock lock(m_critSection); - if (m_endTime != end) - { - m_endTime = end; - m_bChanged = true; - bUpdate = true; - } - } - if (bUpdate) - UpdatePath(); -} - -void CEpgInfoTag::SetEndFromLocalTime(const CDateTime &end) -{ - CDateTime tmp = end.GetAsUTCDateTime(); - SetEndFromUTC(tmp); + m_endTime = end; } int CEpgInfoTag::GetDuration(void) const { time_t start, end; - CSingleLock lock(m_critSection); m_startTime.GetAsTime(start); m_endTime.GetAsTime(end); return end - start > 0 ? end - start : 3600; } -void CEpgInfoTag::SetTitle(const std::string &strTitle) -{ - bool bUpdate(false); - { - CSingleLock lock(m_critSection); - if (m_strTitle != strTitle) - { - m_strTitle = strTitle; - m_bChanged = true; - bUpdate = true; - } - } - if (bUpdate) - UpdatePath(); -} - std::string CEpgInfoTag::Title(bool bOverrideParental /* = false */) const { std::string strTitle; bool bParentalLocked(false); - { - CSingleLock lock(m_critSection); - strTitle = m_strTitle; - if (m_pvrChannel) - bParentalLocked = g_PVRManager.IsParentalLocked(m_pvrChannel); - } + if (m_pvrChannel) + bParentalLocked = g_PVRManager.IsParentalLocked(m_pvrChannel); if (!bOverrideParental && bParentalLocked) strTitle = g_localizeStrings.Get(19266); // parental locked else if (strTitle.empty() && !CSettings::Get().GetBool("epg.hidenoinfoavailable")) strTitle = g_localizeStrings.Get(19055); // no information available + else + strTitle = m_strTitle; return strTitle; } -void CEpgInfoTag::SetPlotOutline(const std::string &strPlotOutline) -{ - bool bUpdate(false); - { - CSingleLock lock(m_critSection); - if (m_strPlotOutline != strPlotOutline) - { - m_strPlotOutline = strPlotOutline; - m_bChanged = true; - bUpdate = true; - } - } - if (bUpdate) - UpdatePath(); -} - std::string CEpgInfoTag::PlotOutline(bool bOverrideParental /* = false */) const { std::string retVal; - CSingleLock lock(m_critSection); if (bOverrideParental || !m_pvrChannel || !g_PVRManager.IsParentalLocked(m_pvrChannel)) retVal = m_strPlotOutline; return retVal; } -void CEpgInfoTag::SetPlot(const std::string &strPlot) -{ - bool bUpdate(false); - { - CSingleLock lock(m_critSection); - bUpdate = m_strPlot != strPlot; - m_bChanged |= bUpdate; - m_strPlot = strPlot; - } - if (bUpdate) - UpdatePath(); -} - std::string CEpgInfoTag::Plot(bool bOverrideParental /* = false */) const { std::string retVal; - CSingleLock lock(m_critSection); if (bOverrideParental || !m_pvrChannel || !g_PVRManager.IsParentalLocked(m_pvrChannel)) retVal = m_strPlot; return retVal; } -void CEpgInfoTag::SetGenre(int iID, int iSubID, const char* strGenre) +void CEpgInfoTag::SetGenre(int iGenreType, int iGenreSubType, const char* strGenre) { - bool bUpdate(false); + if (m_iGenreType != iGenreType || m_iGenreSubType != iGenreSubType) { - CSingleLock lock(m_critSection); - if (m_iGenreType != iID || m_iGenreSubType != iSubID) + m_iGenreType = iGenreType; + m_iGenreSubType = iGenreSubType; + if ((iGenreType == EPG_GENRE_USE_STRING) && (strGenre != NULL) && (strlen(strGenre) > 0)) { - m_iGenreType = iID; - m_iGenreSubType = iSubID; - if ((iID == EPG_GENRE_USE_STRING) && (strGenre != NULL) && (strlen(strGenre) > 0)) - { - /* Type and sub type are not given. No EPG color coding possible - * Use the provided genre description as backup. */ - m_genre = StringUtils::Split(strGenre, g_advancedSettings.m_videoItemSeparator); - } - else - { - /* Determine the genre description from the type and subtype IDs */ - m_genre = StringUtils::Split(CEpg::ConvertGenreIdToString(iID, iSubID), g_advancedSettings.m_videoItemSeparator); - } - m_bChanged = true; - bUpdate = true; + /* Type and sub type are not given. No EPG color coding possible + * Use the provided genre description as backup. */ + m_genre = StringUtils::Split(strGenre, g_advancedSettings.m_videoItemSeparator); + } + else + { + /* Determine the genre description from the type and subtype IDs */ + m_genre = StringUtils::Split(CEpg::ConvertGenreIdToString(iGenreType, iGenreSubType), g_advancedSettings.m_videoItemSeparator); } } - if (bUpdate) - UpdatePath(); } int CEpgInfoTag::GenreType(void) const { - CSingleLock lock(m_critSection); return m_iGenreType; } int CEpgInfoTag::GenreSubType(void) const { - CSingleLock lock(m_critSection); return m_iGenreSubType; } const vector CEpgInfoTag::Genre(void) const { - vector retVal; - CSingleLock lock(m_critSection); - retVal = m_genre; - return retVal; + return m_genre; } CDateTime CEpgInfoTag::FirstAiredAsUTC(void) const { - CDateTime retVal; - CSingleLock lock(m_critSection); - retVal = m_firstAired; - return retVal; + return m_firstAired; } CDateTime CEpgInfoTag::FirstAiredAsLocalTime(void) const { CDateTime retVal; - CSingleLock lock(m_critSection); retVal.SetFromUTCDateTime(m_firstAired); return retVal; } -void CEpgInfoTag::SetFirstAiredFromUTC(const CDateTime &firstAired) -{ - bool bUpdate(false); - { - CSingleLock lock(m_critSection); - if (m_firstAired != firstAired) - { - m_firstAired = firstAired; - m_bChanged = true; - bUpdate = true; - } - } - if (bUpdate) - UpdatePath(); -} - -void CEpgInfoTag::SetFirstAiredFromLocalTime(const CDateTime &firstAired) -{ - CDateTime tmp = firstAired.GetAsUTCDateTime(); - SetFirstAiredFromUTC(tmp); -} - -void CEpgInfoTag::SetParentalRating(int iParentalRating) -{ - bool bUpdate(false); - { - CSingleLock lock(m_critSection); - if (m_iParentalRating != iParentalRating) - { - m_iParentalRating = iParentalRating; - m_bChanged = true; - bUpdate = true; - } - } - if (bUpdate) - UpdatePath(); -} - int CEpgInfoTag::ParentalRating(void) const { - CSingleLock lock(m_critSection); return m_iParentalRating; } -void CEpgInfoTag::SetStarRating(int iStarRating) -{ - bool bUpdate(false); - { - CSingleLock lock(m_critSection); - if (m_iStarRating != iStarRating) - { - m_iStarRating = iStarRating; - m_bChanged = true; - bUpdate = true; - } - } - if (bUpdate) - UpdatePath(); -} - int CEpgInfoTag::StarRating(void) const { - CSingleLock lock(m_critSection); return m_iStarRating; } -void CEpgInfoTag::SetNotify(bool bNotify) -{ - bool bUpdate(false); - { - CSingleLock lock(m_critSection); - if (m_bNotify != bNotify) - { - m_bNotify = bNotify; - m_bChanged = true; - bUpdate = true; - } - } - if (bUpdate) - UpdatePath(); -} - bool CEpgInfoTag::Notify(void) const { - CSingleLock lock(m_critSection); return m_bNotify; } -void CEpgInfoTag::SetSeriesNum(int iSeriesNum) +int CEpgInfoTag::SeriesNumber(void) const { - bool bUpdate(false); - { - CSingleLock lock(m_critSection); - if (m_iSeriesNumber != iSeriesNum) - { - m_iSeriesNumber = iSeriesNum; - m_bChanged = true; - bUpdate = true; - } - } - if (bUpdate) - UpdatePath(); -} - -int CEpgInfoTag::SeriesNum(void) const -{ - CSingleLock lock(m_critSection); return m_iSeriesNumber; } -void CEpgInfoTag::SetEpisodeNum(int iEpisodeNum) -{ - bool bUpdate(false); - { - CSingleLock lock(m_critSection); - if (m_iEpisodeNumber != iEpisodeNum) - { - m_iEpisodeNumber = iEpisodeNum; - m_bChanged = true; - bUpdate = true; - } - } - if (bUpdate) - UpdatePath(); -} - -int CEpgInfoTag::EpisodeNum(void) const +int CEpgInfoTag::EpisodeNumber(void) const { - CSingleLock lock(m_critSection); return m_iEpisodeNumber; } -void CEpgInfoTag::SetEpisodePart(int iEpisodePart) -{ - bool bUpdate(false); - { - CSingleLock lock(m_critSection); - if (m_iEpisodePart != iEpisodePart) - { - m_iEpisodePart = iEpisodePart; - m_bChanged = true; - bUpdate = true; - } - } - if (bUpdate) - UpdatePath(); -} - int CEpgInfoTag::EpisodePart(void) const { - CSingleLock lock(m_critSection); return m_iEpisodePart; } -void CEpgInfoTag::SetEpisodeName(const std::string &strEpisodeName) -{ - bool bUpdate(false); - { - CSingleLock lock(m_critSection); - if (m_strEpisodeName != strEpisodeName) - { - m_strEpisodeName = strEpisodeName; - m_bChanged = true; - bUpdate = true; - } - } - if (bUpdate) - UpdatePath(); -} - std::string CEpgInfoTag::EpisodeName(void) const { - std::string retVal; - CSingleLock lock(m_critSection); - retVal = m_strEpisodeName; - return retVal; -} - -void CEpgInfoTag::SetIcon(const std::string &strIconPath) -{ - bool bUpdate(false); - { - CSingleLock lock(m_critSection); - if (m_strIconPath != strIconPath) - { - m_strIconPath = strIconPath; - m_bChanged = true; - bUpdate = true; - } - } - if (bUpdate) - UpdatePath(); + return m_strEpisodeName; } std::string CEpgInfoTag::Icon(void) const { - std::string retVal; - - CSingleLock lock(m_critSection); - retVal = m_strIconPath; - return retVal; -} - -void CEpgInfoTag::SetPath(const std::string &strFileNameAndPath) -{ - CSingleLock lock(m_critSection); - if (m_strFileNameAndPath != strFileNameAndPath) - { - m_strFileNameAndPath = strFileNameAndPath; - m_bChanged = true; - } + return m_strIconPath; } std::string CEpgInfoTag::Path(void) const { - string retVal; - CSingleLock lock(m_critSection); - retVal = m_strFileNameAndPath; - return retVal; -} - -void CEpgInfoTag::SetRecordingId(const std::string &strRecordingId) -{ - CSingleLock lock(m_critSection); - if (m_strRecordingId != strRecordingId) - { - m_strRecordingId = strRecordingId; - m_bChanged = true; - } + return m_strFileNameAndPath; } const std::string& CEpgInfoTag::RecordingId(void) const { - CSingleLock lock(m_critSection); return m_strRecordingId; } bool CEpgInfoTag::HasRecordingId(void) const { - CSingleLock lock(m_critSection); return !m_strRecordingId.empty(); } - -//void CEpgInfoTag::SetTimer(CPVRTimerInfoTagPtr newTimer) -//{ -// CPVRTimerInfoTagPtr oldTimer; -// { -// CSingleLock lock(m_critSection); -// oldTimer = m_timer; -// m_timer = newTimer; -// } -// if (oldTimer) -// oldTimer->ClearEpgTag(); -//} - bool CEpgInfoTag::HasTimer(void) const { - CSingleLock lock(m_critSection); return m_timer != NULL; } CPVRTimerInfoTagPtr CEpgInfoTag::Timer(void) const { - CSingleLock lock(m_critSection); return m_timer; } void CEpgInfoTag::SetPVRChannel(PVR::CPVRChannelPtr channel) { - CSingleLock lock(m_critSection); m_pvrChannel = channel; } bool CEpgInfoTag::HasPVRChannel(void) const { - CSingleLock lock(m_critSection); return m_pvrChannel != NULL; } int CEpgInfoTag::PVRChannelNumber(void) const { - CSingleLock lock(m_critSection); return m_pvrChannel ? m_pvrChannel->ChannelNumber() : -1; } std::string CEpgInfoTag::PVRChannelName(void) const { std::string strReturn; - CSingleLock lock(m_critSection); if (m_pvrChannel) strReturn = m_pvrChannel->ChannelName(); return strReturn; @@ -846,7 +487,6 @@ std::string CEpgInfoTag::PVRChannelName(void) const const PVR::CPVRChannelPtr CEpgInfoTag::ChannelTag(void) const { - CSingleLock lock(m_critSection); return m_pvrChannel; } @@ -854,7 +494,6 @@ bool CEpgInfoTag::Update(const CEpgInfoTag &tag, bool bUpdateBroadcastId /* = tr { bool bChanged(false); { - CSingleLock lock(m_critSection); bChanged = ( m_strTitle != tag.m_strTitle || m_strPlotOutline != tag.m_strPlotOutline || @@ -916,8 +555,6 @@ bool CEpgInfoTag::Update(const CEpgInfoTag &tag, bool bUpdateBroadcastId /* = tr m_iUniqueBroadcastID = tag.m_iUniqueBroadcastID; m_strRecordingId = tag.m_strRecordingId; m_strIconPath = tag.m_strIconPath; - - m_bChanged = true; } } if (bChanged) @@ -929,9 +566,6 @@ bool CEpgInfoTag::Update(const CEpgInfoTag &tag, bool bUpdateBroadcastId /* = tr bool CEpgInfoTag::Persist(bool bSingleUpdate /* = true */) { bool bReturn = false; - CSingleLock lock(m_critSection); - if (!m_bChanged) - return true; #if EPG_DEBUGGING CLog::Log(LOGDEBUG, "Epg - %s - Infotag '%s' %s, persisting...", __FUNCTION__, m_strTitle.c_str(), m_iBroadcastId > 0 ? "has changes" : "is new"); @@ -950,10 +584,7 @@ bool CEpgInfoTag::Persist(bool bSingleUpdate /* = true */) bReturn = true; if (iId > 0) - { m_iBroadcastId = iId; - m_bChanged = false; - } } return bReturn; @@ -961,13 +592,7 @@ bool CEpgInfoTag::Persist(bool bSingleUpdate /* = true */) void CEpgInfoTag::UpdatePath(void) { - std::string path; - { - CSingleLock lock(m_critSection); - path = StringUtils::Format("pvr://guide/%04i/%s.epg", EpgID(), m_startTime.GetAsDBDateTime().c_str()); - } - - SetPath(path); + m_strFileNameAndPath = StringUtils::Format("pvr://guide/%04i/%s.epg", EpgID(), m_startTime.GetAsDBDateTime().c_str()); } const CEpg *CEpgInfoTag::GetTable() const @@ -982,19 +607,15 @@ const int CEpgInfoTag::EpgID(void) const void CEpgInfoTag::SetTimer(CPVRTimerInfoTagPtr timer) { - CSingleLock lock(m_critSection); m_timer = timer; } void CEpgInfoTag::ClearTimer(void) { CPVRTimerInfoTagPtr previousTag; - { - CSingleLock lock(m_critSection); - previousTag = m_timer; - CPVRTimerInfoTagPtr empty; - m_timer = empty; - } + previousTag = m_timer; + CPVRTimerInfoTagPtr empty; + m_timer = empty; if (previousTag) previousTag->ClearEpgTag(); @@ -1002,33 +623,26 @@ void CEpgInfoTag::ClearTimer(void) void CEpgInfoTag::SetRecording(CPVRRecordingPtr recording) { - CSingleLock lock(m_critSection); - if (m_recording != recording) - { - m_recording = recording; - m_bChanged = true; - } + m_recording = recording; } void CEpgInfoTag::ClearRecording(void) { - CSingleLock lock(m_critSection); - if (m_recording) - { - CPVRRecordingPtr emptyRecording; - m_recording = emptyRecording; - m_bChanged = true; - } + CPVRRecordingPtr emptyRecording; + m_recording = emptyRecording; } bool CEpgInfoTag::HasRecording(void) const { - CSingleLock lock(m_critSection); return m_recording != NULL; } CPVRRecordingPtr CEpgInfoTag::Recording(void) const { - CSingleLock lock(m_critSection); return m_recording; } + +void CEpgInfoTag::SetEpg(CEpg *epg) +{ + m_epg = epg; +} diff --git a/xbmc/epg/EpgInfoTag.h b/xbmc/epg/EpgInfoTag.h index 2fc6afb171ead..d3c20d2fc7543 100644 --- a/xbmc/epg/EpgInfoTag.h +++ b/xbmc/epg/EpgInfoTag.h @@ -88,12 +88,6 @@ namespace EPG virtual void Serialize(CVariant &value) const; - /*! - * @brief Check whether this tag has changed and unsaved values. - * @return True if it has unsaved values, false otherwise. - */ - bool Changed(void) const; - /*! * @brief Check if this event is currently active. * @return True if it's active, false otherwise. @@ -106,9 +100,9 @@ namespace EPG bool WasActive(void) const; /*! - * @return True when this event is in the future, false otherwise. + * @return True when this event is an upcoming event, false otherwise. */ - bool InTheFuture(void) const; + bool IsUpcoming(void) const; /*! * @return The current progress of this tag. @@ -140,6 +134,12 @@ namespace EPG const int EpgID(void) const; + /*! + * @brief Sets the epg reference of this event + * @param epg The epg item + */ + void SetEpg(CEpg *epg); + /*! * @brief Change the unique broadcast ID of this event. * @param iUniqueBroadcastId The new unique broadcast ID. @@ -152,12 +152,6 @@ namespace EPG */ int UniqueBroadcastID(void) const; - /*! - * @brief Change the event's database ID. - * @param iId The new database ID. - */ - void SetBroadcastId(int iId); - /*! * @brief Get the event's database ID. * @return The database ID. @@ -171,13 +165,6 @@ namespace EPG CDateTime StartAsUTC(void) const; CDateTime StartAsLocalTime(void) const; - /*! - * @brief Change the event's start time. - * @param start The new start time. - */ - void SetStartFromUTC(const CDateTime &start); - void SetStartFromLocalTime(const CDateTime &start); - /*! * @brief Get the event's end time. * @return The new start time. @@ -190,7 +177,6 @@ namespace EPG * @param end The new end time. */ void SetEndFromUTC(const CDateTime &end); - void SetEndFromLocalTime(const CDateTime &end); /*! * @brief Get the duration of this event in seconds. @@ -198,12 +184,6 @@ namespace EPG */ int GetDuration(void) const; - /*! - * @brief Change the title of this event. - * @param strTitle The new title. - */ - void SetTitle(const std::string &strTitle); - /*! * @brief Get the title of this event. * @param bOverrideParental True to override parental control, false check it. @@ -211,12 +191,6 @@ namespace EPG */ std::string Title(bool bOverrideParental = false) const; - /*! - * @brief Change the plot outline of this event. - * @param strPlotOutline The new plot outline. - */ - void SetPlotOutline(const std::string &strPlotOutline); - /*! * @brief Get the plot outline of this event. * @param bOverrideParental True to override parental control, false check it. @@ -224,12 +198,6 @@ namespace EPG */ std::string PlotOutline(bool bOverrideParental = false) const; - /*! - * @brief Change the plot of this event. - * @param strPlot The new plot. - */ - void SetPlot(const std::string &strPlot); - /*! * @brief Get the plot of this event. * @param bOverrideParental True to override parental control, false check it. @@ -237,13 +205,6 @@ namespace EPG */ std::string Plot(bool bOverrideParental = false) const; - /*! - * @brief Change the genre of this event. - * @param iID The genre type ID. - * @param iSubID The genre subtype ID. - */ - void SetGenre(int iID, int iSubID, const char* strGenre); - /*! * @brief Get the genre type ID of this event. * @return The genre type ID. @@ -262,13 +223,6 @@ namespace EPG */ const std::vector Genre(void) const; - /*! - * @brief Change the first air date of this event. - * @param firstAired The new first air date. - */ - void SetFirstAiredFromUTC(const CDateTime &firstAired); - void SetFirstAiredFromLocalTime(const CDateTime &firstAired); - /*! * @brief Get the first air date of this event. * @return The first air date. @@ -276,71 +230,35 @@ namespace EPG CDateTime FirstAiredAsUTC(void) const; CDateTime FirstAiredAsLocalTime(void) const; - /*! - * @brief Change the parental rating of this event. - * @param iParentalRating The new parental rating. - */ - void SetParentalRating(int iParentalRating); - /*! * @brief Get the parental rating of this event. * @return The parental rating. */ int ParentalRating(void) const; - /*! - * @brief Change the star rating of this event. - * @param iStarRating The new star rating. - */ - void SetStarRating(int iStarRating); - /*! * @brief Get the star rating of this event. * @return The star rating. */ int StarRating(void) const; - /*! - * @brief Change the value of notify on start. - * @param bNotify The new value. - */ - void SetNotify(bool bNotify); - /*! * @brief Notify on start if true. * @return Notify on start. */ bool Notify(void) const; - /*! - * @brief Change the series number of this event. - * @param iSeriesNum The new series number. - */ - void SetSeriesNum(int iSeriesNum); - /*! * @brief The series number of this event. * @return The series number. */ - int SeriesNum(void) const; - - /*! - * @brief Change the episode number of this event. - * @param iEpisodeNum The new episode number. - */ - void SetEpisodeNum(int iEpisodeNum); + int SeriesNumber(void) const; /*! * @brief The episode number of this event. * @return The episode number. */ - int EpisodeNum(void) const; - - /*! - * @brief Change the episode part number of this event. - * @param iEpisodePart The new episode part number. - */ - void SetEpisodePart(int iEpisodePart); + int EpisodeNumber(void) const; /*! * @brief The episode part number of this event. @@ -348,48 +266,24 @@ namespace EPG */ int EpisodePart(void) const; - /*! - * @brief Change the episode name of this event. - * @param strEpisodeName The new episode name. - */ - void SetEpisodeName(const std::string &strEpisodeName); - /*! * @brief The episode name of this event. * @return The episode name. */ std::string EpisodeName(void) const; - /*! - * @brief Change the path to the icon for this event. - * @param strIconPath The new path. - */ - void SetIcon(const std::string &strIconPath); - /*! * @brief Get the path to the icon for this event. * @return The path to the icon */ std::string Icon(void) const; - /*! - * @brief Change the path to this event. - * @param strFileNameAndPath The new path. - */ - void SetPath(const std::string &strFileNameAndPath); - /*! * @brief The path to this event. * @return The path. */ std::string Path(void) const; - /*! - * @brief Change the recording ID to this event. - * @param strRecordingId The new recording ID. - */ - void SetRecordingId(const std::string &strRecordingId); - /*! * @brief The recording ID to this event. * @return The recording ID. @@ -481,6 +375,14 @@ namespace EPG bool Update(const CEpgInfoTag &tag, bool bUpdateBroadcastId = true); private: + + /*! + * @brief Change the genre of this event. + * @param iGenreType The genre type ID. + * @param iGenreSubType The genre subtype ID. + */ + void SetGenre(int iGenreType, int iGenreSubType, const char* strGenre); + /*! * @brief Hook that is called when the start date changed. */ @@ -492,7 +394,6 @@ namespace EPG CDateTime GetCurrentPlayingTime(void) const; bool m_bNotify; /*!< notify on start */ - bool m_bChanged; /*!< keep track of changes to this entry */ int m_iBroadcastId; /*!< database ID */ int m_iGenreType; /*!< genre type */ @@ -520,7 +421,6 @@ namespace EPG CEpg * m_epg; /*!< the schedule that this event belongs to */ - PVR::CPVRChannelPtr m_pvrChannel; - CCriticalSection m_critSection; + PVR::CPVRChannelPtr m_pvrChannel; }; } diff --git a/xbmc/pvr/PVRManager.cpp b/xbmc/pvr/PVRManager.cpp index ba6b221226992..3bdbef12733ea 100644 --- a/xbmc/pvr/PVRManager.cpp +++ b/xbmc/pvr/PVRManager.cpp @@ -1181,7 +1181,7 @@ bool CPVRManager::UpdateItem(CFileItem& item) videotag->m_strFileNameAndPath = channelTag->Path(); videotag->m_strPlot = epgTagNow ? epgTagNow->Plot() : ""; videotag->m_strPlotOutline = epgTagNow ? epgTagNow->PlotOutline() : ""; - videotag->m_iEpisode = epgTagNow ? epgTagNow->EpisodeNum() : 0; + videotag->m_iEpisode = epgTagNow ? epgTagNow->EpisodeNumber() : 0; } }