From cdbca43e46a3126bbf124e6b3b281fbdd988526c Mon Sep 17 00:00:00 2001 From: xhaggi Date: Thu, 19 Feb 2015 11:21:57 +0100 Subject: [PATCH 1/5] [epg] get rid of mutex lock, m_bChanged and unnecessary calls to UpdatePath() in CEpgInfoTag --- xbmc/epg/Epg.cpp | 1 - xbmc/epg/EpgInfoTag.cpp | 393 +++++----------------------------------- xbmc/epg/EpgInfoTag.h | 8 - 3 files changed, 50 insertions(+), 352 deletions(-) diff --git a/xbmc/epg/Epg.cpp b/xbmc/epg/Epg.cpp index f688bf826496c..76ee3d441a91d 100644 --- a/xbmc/epg/Epg.cpp +++ b/xbmc/epg/Epg.cpp @@ -304,7 +304,6 @@ void CEpg::AddEntry(const CEpgInfoTag &tag) newTag->SetPVRChannel(m_pvrChannel); newTag->m_epg = this; UpdateRecording(newTag); - newTag->m_bChanged = false; } } diff --git a/xbmc/epg/EpgInfoTag.cpp b/xbmc/epg/EpgInfoTag.cpp index bd8b490b189e7..09b5a9ee3934d 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), @@ -127,9 +125,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 +182,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 +200,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 { CDateTime now = GetCurrentPlayingTime(); - CSingleLock lock(m_critSection); return (m_startTime > now); } @@ -235,7 +222,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 +240,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,76 +260,43 @@ 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(); + m_iBroadcastId = iId; } 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); + if (m_startTime != start) { - CSingleLock lock(m_critSection); - if (m_startTime != start) - { - m_startTime = start; - m_bChanged = true; - bUpdate = true; - } - } - if (bUpdate) + m_startTime = start; UpdatePath(); + } } void CEpgInfoTag::SetStartFromLocalTime(const CDateTime &start) @@ -355,34 +307,19 @@ void CEpgInfoTag::SetStartFromLocalTime(const CDateTime &start) 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(); + m_endTime = end; } void CEpgInfoTag::SetEndFromLocalTime(const CDateTime &end) @@ -394,7 +331,6 @@ void CEpgInfoTag::SetEndFromLocalTime(const CDateTime &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; @@ -402,18 +338,7 @@ int CEpgInfoTag::GetDuration(void) const 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(); + m_strTitle = strTitle; } std::string CEpgInfoTag::Title(bool bOverrideParental /* = false */) const @@ -421,41 +346,27 @@ 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(); + m_strPlotOutline = strPlotOutline; } 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; @@ -464,21 +375,12 @@ std::string CEpgInfoTag::PlotOutline(bool bOverrideParental /* = false */) const 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(); + m_strPlot = strPlot; } 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; @@ -487,82 +389,54 @@ std::string CEpgInfoTag::Plot(bool bOverrideParental /* = false */) const void CEpgInfoTag::SetGenre(int iID, int iSubID, const char* strGenre) { - bool bUpdate(false); + if (m_iGenreType != iID || m_iGenreSubType != iSubID) { - CSingleLock lock(m_critSection); - if (m_iGenreType != iID || m_iGenreSubType != iSubID) + m_iGenreType = iID; + m_iGenreSubType = iSubID; + if ((iID == 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(iID, iSubID), 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(); + m_firstAired = firstAired; } void CEpgInfoTag::SetFirstAiredFromLocalTime(const CDateTime &firstAired) @@ -573,272 +447,137 @@ void CEpgInfoTag::SetFirstAiredFromLocalTime(const CDateTime &firstAired) 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(); + m_iParentalRating = iParentalRating; } 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(); + m_iStarRating = iStarRating; } 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(); + m_bNotify = bNotify; } bool CEpgInfoTag::Notify(void) const { - CSingleLock lock(m_critSection); return m_bNotify; } void CEpgInfoTag::SetSeriesNum(int iSeriesNum) { - bool bUpdate(false); - { - CSingleLock lock(m_critSection); - if (m_iSeriesNumber != iSeriesNum) - { - m_iSeriesNumber = iSeriesNum; - m_bChanged = true; - bUpdate = true; - } - } - if (bUpdate) - UpdatePath(); + m_iSeriesNumber = iSeriesNum; } 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(); + m_iEpisodeNumber = iEpisodeNum; } int CEpgInfoTag::EpisodeNum(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(); + m_iEpisodePart = iEpisodePart; } 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(); + m_strEpisodeName = strEpisodeName; } std::string CEpgInfoTag::EpisodeName(void) const { - std::string retVal; - CSingleLock lock(m_critSection); - retVal = m_strEpisodeName; - return retVal; + return m_strEpisodeName; } 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(); + m_strIconPath = strIconPath; } std::string CEpgInfoTag::Icon(void) const { - std::string retVal; - - CSingleLock lock(m_critSection); - retVal = m_strIconPath; - return retVal; + return m_strIconPath; } void CEpgInfoTag::SetPath(const std::string &strFileNameAndPath) { - CSingleLock lock(m_critSection); - if (m_strFileNameAndPath != strFileNameAndPath) - { - m_strFileNameAndPath = strFileNameAndPath; - m_bChanged = true; - } + m_strFileNameAndPath = strFileNameAndPath; } std::string CEpgInfoTag::Path(void) const { - string retVal; - CSingleLock lock(m_critSection); - retVal = m_strFileNameAndPath; - return retVal; + return m_strFileNameAndPath; } void CEpgInfoTag::SetRecordingId(const std::string &strRecordingId) { - CSingleLock lock(m_critSection); - if (m_strRecordingId != strRecordingId) - { - m_strRecordingId = strRecordingId; - m_bChanged = true; - } + m_strRecordingId = strRecordingId; } 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 +585,6 @@ std::string CEpgInfoTag::PVRChannelName(void) const const PVR::CPVRChannelPtr CEpgInfoTag::ChannelTag(void) const { - CSingleLock lock(m_critSection); return m_pvrChannel; } @@ -854,7 +592,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 +653,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 +664,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 +682,7 @@ bool CEpgInfoTag::Persist(bool bSingleUpdate /* = true */) bReturn = true; if (iId > 0) - { m_iBroadcastId = iId; - m_bChanged = false; - } } return bReturn; @@ -961,13 +690,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); + SetPath(StringUtils::Format("pvr://guide/%04i/%s.epg", EpgID(), m_startTime.GetAsDBDateTime().c_str())); } const CEpg *CEpgInfoTag::GetTable() const @@ -982,19 +705,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 +721,21 @@ 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; } diff --git a/xbmc/epg/EpgInfoTag.h b/xbmc/epg/EpgInfoTag.h index 2fc6afb171ead..879761e7a97c5 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. @@ -492,7 +486,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 */ @@ -521,6 +514,5 @@ namespace EPG CEpg * m_epg; /*!< the schedule that this event belongs to */ PVR::CPVRChannelPtr m_pvrChannel; - CCriticalSection m_critSection; }; } From 841204bf545f76c7a02b89fe687b3968159265f6 Mon Sep 17 00:00:00 2001 From: xhaggi Date: Thu, 19 Feb 2015 11:37:53 +0100 Subject: [PATCH 2/5] [epg] refactor: changes some method signatures in CEPGInfoTag --- xbmc/epg/Epg.cpp | 2 +- xbmc/epg/EpgDatabase.cpp | 4 ++-- xbmc/epg/EpgInfoTag.cpp | 32 ++++++++++++++++---------------- xbmc/epg/EpgInfoTag.h | 26 +++++++++++++------------- xbmc/pvr/PVRManager.cpp | 2 +- 5 files changed, 33 insertions(+), 33 deletions(-) diff --git a/xbmc/epg/Epg.cpp b/xbmc/epg/Epg.cpp index 76ee3d441a91d..6d82648e67e02 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; } } 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 09b5a9ee3934d..fe1b9e299508a 100644 --- a/xbmc/epg/EpgInfoTag.cpp +++ b/xbmc/epg/EpgInfoTag.cpp @@ -96,7 +96,7 @@ CEpgInfoTag::CEpgInfoTag(const EPG_TAG &data) : SetUniqueBroadcastID(data.iUniqueBroadcastId); SetNotify(data.bNotify); SetFirstAiredFromUTC(data.firstAired + g_advancedSettings.m_iPVRTimeCorrection); - SetEpisodeNum(data.iEpisodeNumber); + SetEpisodeNumber(data.iEpisodeNumber); SetEpisodePart(data.iEpisodePartNumber); SetStarRating(data.iStarRating); @@ -209,7 +209,7 @@ bool CEpgInfoTag::WasActive(void) const return (m_endTime < now); } -bool CEpgInfoTag::InTheFuture(void) const +bool CEpgInfoTag::IsUpcoming(void) const { CDateTime now = GetCurrentPlayingTime(); return (m_startTime > now); @@ -268,9 +268,9 @@ int CEpgInfoTag::UniqueBroadcastID(void) const return m_iUniqueBroadcastID; } -void CEpgInfoTag::SetBroadcastId(int iId) +void CEpgInfoTag::SetBroadcastId(int iBroadcastID) { - m_iBroadcastId = iId; + m_iBroadcastId = iBroadcastID; } int CEpgInfoTag::BroadcastId(void) const @@ -387,13 +387,13 @@ std::string CEpgInfoTag::Plot(bool bOverrideParental /* = false */) const return retVal; } -void CEpgInfoTag::SetGenre(int iID, int iSubID, const char* strGenre) +void CEpgInfoTag::SetGenre(int iGenreType, int iGenreSubType, const char* strGenre) { - if (m_iGenreType != iID || m_iGenreSubType != iSubID) + if (m_iGenreType != iGenreType || m_iGenreSubType != iGenreSubType) { - m_iGenreType = iID; - m_iGenreSubType = iSubID; - if ((iID == EPG_GENRE_USE_STRING) && (strGenre != NULL) && (strlen(strGenre) > 0)) + m_iGenreType = iGenreType; + m_iGenreSubType = iGenreSubType; + if ((iGenreType == 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. */ @@ -402,7 +402,7 @@ void CEpgInfoTag::SetGenre(int iID, int iSubID, const char* strGenre) else { /* Determine the genre description from the type and subtype IDs */ - m_genre = StringUtils::Split(CEpg::ConvertGenreIdToString(iID, iSubID), g_advancedSettings.m_videoItemSeparator); + m_genre = StringUtils::Split(CEpg::ConvertGenreIdToString(iGenreType, iGenreSubType), g_advancedSettings.m_videoItemSeparator); } } } @@ -475,22 +475,22 @@ bool CEpgInfoTag::Notify(void) const return m_bNotify; } -void CEpgInfoTag::SetSeriesNum(int iSeriesNum) +void CEpgInfoTag::SetSeriesNumber(int iSeriesNumber) { - m_iSeriesNumber = iSeriesNum; + m_iSeriesNumber = iSeriesNumber; } -int CEpgInfoTag::SeriesNum(void) const +int CEpgInfoTag::SeriesNumber(void) const { return m_iSeriesNumber; } -void CEpgInfoTag::SetEpisodeNum(int iEpisodeNum) +void CEpgInfoTag::SetEpisodeNumber(int iEpisodeNumber) { - m_iEpisodeNumber = iEpisodeNum; + m_iEpisodeNumber = iEpisodeNumber; } -int CEpgInfoTag::EpisodeNum(void) const +int CEpgInfoTag::EpisodeNumber(void) const { return m_iEpisodeNumber; } diff --git a/xbmc/epg/EpgInfoTag.h b/xbmc/epg/EpgInfoTag.h index 879761e7a97c5..061567ae02148 100644 --- a/xbmc/epg/EpgInfoTag.h +++ b/xbmc/epg/EpgInfoTag.h @@ -100,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. @@ -148,9 +148,9 @@ namespace EPG /*! * @brief Change the event's database ID. - * @param iId The new database ID. + * @param iBroadcastID The new database ID. */ - void SetBroadcastId(int iId); + void SetBroadcastId(int iBroadcastID); /*! * @brief Get the event's database ID. @@ -233,10 +233,10 @@ namespace EPG /*! * @brief Change the genre of this event. - * @param iID The genre type ID. - * @param iSubID The genre subtype ID. + * @param iGenreType The genre type ID. + * @param iGenreSubType The genre subtype ID. */ - void SetGenre(int iID, int iSubID, const char* strGenre); + void SetGenre(int iGenreType, int iGenreSubType, const char* strGenre); /*! * @brief Get the genre type ID of this event. @@ -308,27 +308,27 @@ namespace EPG /*! * @brief Change the series number of this event. - * @param iSeriesNum The new series number. + * @param iSeriesNumber The new series number. */ - void SetSeriesNum(int iSeriesNum); + void SetSeriesNumber(int iSeriesNumber); /*! * @brief The series number of this event. * @return The series number. */ - int SeriesNum(void) const; + int SeriesNumber(void) const; /*! * @brief Change the episode number of this event. * @param iEpisodeNum The new episode number. */ - void SetEpisodeNum(int iEpisodeNum); + void SetEpisodeNumber(int iEpisodeNumber); /*! * @brief The episode number of this event. * @return The episode number. */ - int EpisodeNum(void) const; + int EpisodeNumber(void) const; /*! * @brief Change the episode part number of this event. @@ -513,6 +513,6 @@ namespace EPG CEpg * m_epg; /*!< the schedule that this event belongs to */ - PVR::CPVRChannelPtr m_pvrChannel; + 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; } } From dc1aacfb13f2419fb35ab67ecb253fb0d00866ad Mon Sep 17 00:00:00 2001 From: xhaggi Date: Thu, 19 Feb 2015 11:50:43 +0100 Subject: [PATCH 3/5] [epg] adds new method SetEpg() to CEpgInfoTag to drop the use of friend class in CEpg --- xbmc/epg/Epg.cpp | 4 ++-- xbmc/epg/Epg.h | 1 - xbmc/epg/EpgInfoTag.cpp | 5 +++++ xbmc/epg/EpgInfoTag.h | 6 ++++++ 4 files changed, 13 insertions(+), 3 deletions(-) diff --git a/xbmc/epg/Epg.cpp b/xbmc/epg/Epg.cpp index 6d82648e67e02..e8a6397f0b40c 100644 --- a/xbmc/epg/Epg.cpp +++ b/xbmc/epg/Epg.cpp @@ -302,7 +302,7 @@ void CEpg::AddEntry(const CEpgInfoTag &tag) { newTag->Update(tag); newTag->SetPVRChannel(m_pvrChannel); - newTag->m_epg = this; + newTag->SetEpg(this); UpdateRecording(newTag); } } @@ -327,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/EpgInfoTag.cpp b/xbmc/epg/EpgInfoTag.cpp index fe1b9e299508a..1aa55222ffe1b 100644 --- a/xbmc/epg/EpgInfoTag.cpp +++ b/xbmc/epg/EpgInfoTag.cpp @@ -739,3 +739,8 @@ CPVRRecordingPtr CEpgInfoTag::Recording(void) const { return m_recording; } + +void CEpgInfoTag::SetEpg(CEpg *epg) +{ + m_epg = epg; +} diff --git a/xbmc/epg/EpgInfoTag.h b/xbmc/epg/EpgInfoTag.h index 061567ae02148..bb6d4037b8260 100644 --- a/xbmc/epg/EpgInfoTag.h +++ b/xbmc/epg/EpgInfoTag.h @@ -134,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. From 4f3f3245b957bd384b5df6d87230c44ad3d4bc98 Mon Sep 17 00:00:00 2001 From: xhaggi Date: Thu, 19 Feb 2015 12:10:46 +0100 Subject: [PATCH 4/5] [epg] removes some unecessary setters in CEpgInfoTag --- xbmc/epg/EpgInfoTag.cpp | 137 ++++++---------------------------------- xbmc/epg/EpgInfoTag.h | 114 +++------------------------------ 2 files changed, 27 insertions(+), 224 deletions(-) diff --git a/xbmc/epg/EpgInfoTag.cpp b/xbmc/epg/EpgInfoTag.cpp index 1aa55222ffe1b..6e9c75aa0ced1 100644 --- a/xbmc/epg/EpgInfoTag.cpp +++ b/xbmc/epg/EpgInfoTag.cpp @@ -89,30 +89,33 @@ 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_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); - SetEpisodeNumber(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() @@ -268,11 +271,6 @@ int CEpgInfoTag::UniqueBroadcastID(void) const return m_iUniqueBroadcastID; } -void CEpgInfoTag::SetBroadcastId(int iBroadcastID) -{ - m_iBroadcastId = iBroadcastID; -} - int CEpgInfoTag::BroadcastId(void) const { return m_iBroadcastId; @@ -290,21 +288,6 @@ CDateTime CEpgInfoTag::StartAsLocalTime(void) const return retVal; } -void CEpgInfoTag::SetStartFromUTC(const CDateTime &start) -{ - if (m_startTime != start) - { - m_startTime = start; - UpdatePath(); - } -} - -void CEpgInfoTag::SetStartFromLocalTime(const CDateTime &start) -{ - CDateTime tmp = start.GetAsUTCDateTime(); - SetStartFromUTC(tmp); -} - CDateTime CEpgInfoTag::EndAsUTC(void) const { return m_endTime; @@ -322,12 +305,6 @@ void CEpgInfoTag::SetEndFromUTC(const CDateTime &end) m_endTime = end; } -void CEpgInfoTag::SetEndFromLocalTime(const CDateTime &end) -{ - CDateTime tmp = end.GetAsUTCDateTime(); - SetEndFromUTC(tmp); -} - int CEpgInfoTag::GetDuration(void) const { time_t start, end; @@ -336,11 +313,6 @@ int CEpgInfoTag::GetDuration(void) const return end - start > 0 ? end - start : 3600; } -void CEpgInfoTag::SetTitle(const std::string &strTitle) -{ - m_strTitle = strTitle; -} - std::string CEpgInfoTag::Title(bool bOverrideParental /* = false */) const { std::string strTitle; @@ -359,11 +331,6 @@ std::string CEpgInfoTag::Title(bool bOverrideParental /* = false */) const return strTitle; } -void CEpgInfoTag::SetPlotOutline(const std::string &strPlotOutline) -{ - m_strPlotOutline = strPlotOutline; -} - std::string CEpgInfoTag::PlotOutline(bool bOverrideParental /* = false */) const { std::string retVal; @@ -373,11 +340,6 @@ std::string CEpgInfoTag::PlotOutline(bool bOverrideParental /* = false */) const return retVal; } -void CEpgInfoTag::SetPlot(const std::string &strPlot) -{ - m_strPlot = strPlot; -} - std::string CEpgInfoTag::Plot(bool bOverrideParental /* = false */) const { std::string retVal; @@ -434,112 +396,51 @@ CDateTime CEpgInfoTag::FirstAiredAsLocalTime(void) const return retVal; } -void CEpgInfoTag::SetFirstAiredFromUTC(const CDateTime &firstAired) -{ - m_firstAired = firstAired; -} - -void CEpgInfoTag::SetFirstAiredFromLocalTime(const CDateTime &firstAired) -{ - CDateTime tmp = firstAired.GetAsUTCDateTime(); - SetFirstAiredFromUTC(tmp); -} - -void CEpgInfoTag::SetParentalRating(int iParentalRating) -{ - m_iParentalRating = iParentalRating; -} - int CEpgInfoTag::ParentalRating(void) const { return m_iParentalRating; } -void CEpgInfoTag::SetStarRating(int iStarRating) -{ - m_iStarRating = iStarRating; -} - int CEpgInfoTag::StarRating(void) const { return m_iStarRating; } -void CEpgInfoTag::SetNotify(bool bNotify) -{ - m_bNotify = bNotify; -} - bool CEpgInfoTag::Notify(void) const { return m_bNotify; } -void CEpgInfoTag::SetSeriesNumber(int iSeriesNumber) -{ - m_iSeriesNumber = iSeriesNumber; -} - int CEpgInfoTag::SeriesNumber(void) const { return m_iSeriesNumber; } -void CEpgInfoTag::SetEpisodeNumber(int iEpisodeNumber) -{ - m_iEpisodeNumber = iEpisodeNumber; -} - int CEpgInfoTag::EpisodeNumber(void) const { return m_iEpisodeNumber; } -void CEpgInfoTag::SetEpisodePart(int iEpisodePart) -{ - m_iEpisodePart = iEpisodePart; -} - int CEpgInfoTag::EpisodePart(void) const { return m_iEpisodePart; } -void CEpgInfoTag::SetEpisodeName(const std::string &strEpisodeName) -{ - m_strEpisodeName = strEpisodeName; -} - std::string CEpgInfoTag::EpisodeName(void) const { return m_strEpisodeName; } -void CEpgInfoTag::SetIcon(const std::string &strIconPath) -{ - m_strIconPath = strIconPath; -} - std::string CEpgInfoTag::Icon(void) const { return m_strIconPath; } -void CEpgInfoTag::SetPath(const std::string &strFileNameAndPath) -{ - m_strFileNameAndPath = strFileNameAndPath; -} - std::string CEpgInfoTag::Path(void) const { return m_strFileNameAndPath; } -void CEpgInfoTag::SetRecordingId(const std::string &strRecordingId) -{ - m_strRecordingId = strRecordingId; -} - const std::string& CEpgInfoTag::RecordingId(void) const { return m_strRecordingId; @@ -690,7 +591,7 @@ bool CEpgInfoTag::Persist(bool bSingleUpdate /* = true */) void CEpgInfoTag::UpdatePath(void) { - SetPath(StringUtils::Format("pvr://guide/%04i/%s.epg", EpgID(), m_startTime.GetAsDBDateTime().c_str())); + m_strFileNameAndPath = StringUtils::Format("pvr://guide/%04i/%s.epg", EpgID(), m_startTime.GetAsDBDateTime().c_str()); } const CEpg *CEpgInfoTag::GetTable() const diff --git a/xbmc/epg/EpgInfoTag.h b/xbmc/epg/EpgInfoTag.h index bb6d4037b8260..d3c20d2fc7543 100644 --- a/xbmc/epg/EpgInfoTag.h +++ b/xbmc/epg/EpgInfoTag.h @@ -152,12 +152,6 @@ namespace EPG */ int UniqueBroadcastID(void) const; - /*! - * @brief Change the event's database ID. - * @param iBroadcastID The new database ID. - */ - void SetBroadcastId(int iBroadcastID); - /*! * @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 iGenreType The genre type ID. - * @param iGenreSubType The genre subtype ID. - */ - void SetGenre(int iGenreType, int iGenreSubType, 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,120 +230,60 @@ 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 iSeriesNumber The new series number. - */ - void SetSeriesNumber(int iSeriesNumber); - /*! * @brief The series number of this event. * @return The series number. */ int SeriesNumber(void) const; - /*! - * @brief Change the episode number of this event. - * @param iEpisodeNum The new episode number. - */ - void SetEpisodeNumber(int iEpisodeNumber); - /*! * @brief The episode number of this event. * @return The episode number. */ int EpisodeNumber(void) const; - /*! - * @brief Change the episode part number of this event. - * @param iEpisodePart The new episode part number. - */ - void SetEpisodePart(int iEpisodePart); - /*! * @brief The episode part number of this event. * @return The episode part number. */ 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. */ From 056e01760e12bf65bb2365e1463874d69dd05193 Mon Sep 17 00:00:00 2001 From: xhaggi Date: Thu, 19 Feb 2015 12:26:18 +0100 Subject: [PATCH 5/5] [epg] fix missing assignment of series number in constructor --- xbmc/epg/EpgInfoTag.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/xbmc/epg/EpgInfoTag.cpp b/xbmc/epg/EpgInfoTag.cpp index 6e9c75aa0ced1..4755b38cb4ad4 100644 --- a/xbmc/epg/EpgInfoTag.cpp +++ b/xbmc/epg/EpgInfoTag.cpp @@ -95,6 +95,7 @@ CEpgInfoTag::CEpgInfoTag(const EPG_TAG &data) : 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;