aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--xbmc/pvr/channels/PVRChannelGroup.cpp5
-rw-r--r--xbmc/pvr/epg/Epg.cpp4
-rw-r--r--xbmc/pvr/epg/EpgDatabase.cpp8
-rw-r--r--xbmc/pvr/epg/EpgInfoTag.cpp127
-rw-r--r--xbmc/pvr/epg/EpgInfoTag.h212
-rw-r--r--xbmc/pvr/windows/GUIEPGGridContainerModel.cpp10
6 files changed, 181 insertions, 185 deletions
diff --git a/xbmc/pvr/channels/PVRChannelGroup.cpp b/xbmc/pvr/channels/PVRChannelGroup.cpp
index ba936a3746..54d040a8ee 100644
--- a/xbmc/pvr/channels/PVRChannelGroup.cpp
+++ b/xbmc/pvr/channels/PVRChannelGroup.cpp
@@ -945,9 +945,8 @@ int CPVRChannelGroup::GetEPGAll(CFileItemList &results, bool bIncludeChannelsWit
if (bIncludeChannelsWithoutEPG && iAdded == 0)
{
// Add dummy EPG tag associated with this channel
- epgTag = CPVREpgInfoTag::CreateDefaultTag();
- epgTag->SetChannel(channel);
- results.Add(CFileItemPtr(new CFileItem(epgTag)));
+ epgTag = std::make_shared<CPVREpgInfoTag>(channel);
+ results.Add(std::make_shared<CFileItem>(epgTag));
}
}
}
diff --git a/xbmc/pvr/epg/Epg.cpp b/xbmc/pvr/epg/Epg.cpp
index d7ea27df99..ca4c403e87 100644
--- a/xbmc/pvr/epg/Epg.cpp
+++ b/xbmc/pvr/epg/Epg.cpp
@@ -283,7 +283,7 @@ void CPVREpg::AddEntry(const CPVREpgInfoTag &tag)
newTag = it->second;
else
{
- newTag.reset(new CPVREpgInfoTag(this, m_pvrChannel, m_strName, m_pvrChannel ? m_pvrChannel->IconPath() : ""));
+ newTag = std::make_shared<CPVREpgInfoTag>(m_pvrChannel, this, m_strName);
m_tags.insert(std::make_pair(tag.StartAsUTC(), newTag));
}
@@ -399,7 +399,7 @@ bool CPVREpg::UpdateEntry(const CPVREpgInfoTagPtr &tag, bool bUpdateDatabase)
}
else
{
- infoTag.reset(new CPVREpgInfoTag(this, m_pvrChannel, m_strName, m_pvrChannel ? m_pvrChannel->IconPath() : ""));
+ infoTag = std::make_shared<CPVREpgInfoTag>(m_pvrChannel, this, m_strName);
infoTag->SetUniqueBroadcastID(tag->UniqueBroadcastID());
m_tags.insert(std::make_pair(tag->StartAsUTC(), infoTag));
bNewTag = true;
diff --git a/xbmc/pvr/epg/EpgDatabase.cpp b/xbmc/pvr/epg/EpgDatabase.cpp
index 800317ab22..611ed0b414 100644
--- a/xbmc/pvr/epg/EpgDatabase.cpp
+++ b/xbmc/pvr/epg/EpgDatabase.cpp
@@ -185,13 +185,13 @@ bool CPVREpgDatabase::DeleteEpgEntries(const CDateTime &maxEndTime)
bool CPVREpgDatabase::Delete(const CPVREpgInfoTag &tag)
{
/* tag without a database ID was not persisted */
- if (tag.BroadcastId() <= 0)
+ if (tag.DatabaseID() <= 0)
return false;
Filter filter;
CSingleLock lock(m_critSection);
- filter.AppendWhere(PrepareSQL("idBroadcast = %u", tag.BroadcastId()));
+ filter.AppendWhere(PrepareSQL("idBroadcast = %u", tag.DatabaseID()));
return DeleteValues("epgtags", filter);
}
@@ -256,7 +256,7 @@ std::vector<CPVREpgInfoTagPtr> CPVREpgDatabase::Get(const CPVREpg &epg)
// Compat: null value for broadcast uid changed from numerical -1 to 0 with PVR Addon API v4.0.0
newTag->m_iUniqueBroadcastID = iBroadcastUID == -1 ? EPG_TAG_INVALID_UID : iBroadcastUID;
- newTag->m_iBroadcastId = m_pDS->fv("idBroadcast").get_asInt();
+ newTag->m_iDatabaseID = m_pDS->fv("idBroadcast").get_asInt();
newTag->m_strTitle = m_pDS->fv("sTitle").get_asString().c_str();
newTag->m_strPlotOutline = m_pDS->fv("sPlotOutline").get_asString().c_str();
newTag->m_strPlot = m_pDS->fv("sPlot").get_asString().c_str();
@@ -366,7 +366,7 @@ int CPVREpgDatabase::Persist(const CPVREpgInfoTag &tag, bool bSingleUpdate /* =
tag.EndAsUTC().GetAsTime(iEndTime);
tag.FirstAiredAsUTC().GetAsTime(iFirstAired);
- int iBroadcastId = tag.BroadcastId();
+ int iBroadcastId = tag.DatabaseID();
std::string strQuery;
/* Only store the genre string when needed */
diff --git a/xbmc/pvr/epg/EpgInfoTag.cpp b/xbmc/pvr/epg/EpgInfoTag.cpp
index 8cf4a0606f..33c24e4739 100644
--- a/xbmc/pvr/epg/EpgInfoTag.cpp
+++ b/xbmc/pvr/epg/EpgInfoTag.cpp
@@ -27,45 +27,31 @@
using namespace PVR;
-CPVREpgInfoTagPtr CPVREpgInfoTag::CreateDefaultTag()
-{
- return CPVREpgInfoTagPtr(new CPVREpgInfoTag());
-}
-
-CPVREpgInfoTag::CPVREpgInfoTag(void) :
- m_iUniqueBroadcastID(EPG_TAG_INVALID_UID),
- m_iUniqueChannelID(PVR_CHANNEL_INVALID_UID),
- m_iFlags(EPG_TAG_FLAG_UNDEFINED)
-{
-}
-
-CPVREpgInfoTag::CPVREpgInfoTag(CPVREpg *epg, const PVR::CPVRChannelPtr &channel, const std::string &strTableName /* = "" */, const std::string &strIconPath /* = "" */) :
- m_iClientId(channel ? channel->ClientID() : -1),
- m_iUniqueBroadcastID(EPG_TAG_INVALID_UID),
- m_iUniqueChannelID(channel ? channel->UniqueID() : PVR_CHANNEL_INVALID_UID),
- m_strIconPath(strIconPath),
- m_epg(epg),
- m_iFlags(EPG_TAG_FLAG_UNDEFINED),
- m_channel(channel)
+CPVREpgInfoTag::CPVREpgInfoTag(const CPVRChannelPtr &channel, CPVREpg *epg /* = nullptr */, const std::string &strTableName /* = "" */)
+: m_iClientId(channel ? channel->ClientID() : -1),
+ m_iUniqueChannelID(channel ? channel->UniqueID() : PVR_CHANNEL_INVALID_UID),
+ m_strIconPath(channel ? channel->IconPath() : ""),
+ m_epg(epg),
+ m_channel(channel)
{
UpdatePath();
}
-CPVREpgInfoTag::CPVREpgInfoTag(const EPG_TAG &data, int iClientId) :
- m_bNotify(data.bNotify),
- m_iClientId(iClientId),
- m_iParentalRating(data.iParentalRating),
- m_iStarRating(data.iStarRating),
- m_iSeriesNumber(data.iSeriesNumber),
- m_iEpisodeNumber(data.iEpisodeNumber),
- m_iEpisodePart(data.iEpisodePartNumber),
- m_iUniqueBroadcastID(data.iUniqueBroadcastId),
- m_iUniqueChannelID(data.iUniqueChannelId),
- m_iYear(data.iYear),
- m_startTime(data.startTime + g_advancedSettings.m_iPVRTimeCorrection),
- m_endTime(data.endTime + g_advancedSettings.m_iPVRTimeCorrection),
- m_firstAired(data.firstAired + g_advancedSettings.m_iPVRTimeCorrection),
- m_iFlags(data.iFlags)
+CPVREpgInfoTag::CPVREpgInfoTag(const EPG_TAG &data, int iClientId)
+: m_bNotify(data.bNotify),
+ m_iClientId(iClientId),
+ m_iParentalRating(data.iParentalRating),
+ m_iStarRating(data.iStarRating),
+ m_iSeriesNumber(data.iSeriesNumber),
+ m_iEpisodeNumber(data.iEpisodeNumber),
+ m_iEpisodePart(data.iEpisodePartNumber),
+ m_iUniqueBroadcastID(data.iUniqueBroadcastId),
+ m_iUniqueChannelID(data.iUniqueChannelId),
+ m_iYear(data.iYear),
+ m_startTime(data.startTime + g_advancedSettings.m_iPVRTimeCorrection),
+ m_endTime(data.endTime + g_advancedSettings.m_iPVRTimeCorrection),
+ m_firstAired(data.firstAired + g_advancedSettings.m_iPVRTimeCorrection),
+ m_iFlags(data.iFlags)
{
SetGenre(data.iGenreType, data.iGenreSubType, data.strGenreDescription);
@@ -98,9 +84,10 @@ CPVREpgInfoTag::CPVREpgInfoTag(const EPG_TAG &data, int iClientId) :
bool CPVREpgInfoTag::operator ==(const CPVREpgInfoTag& right) const
{
- if (this == &right) return true;
+ if (this == &right)
+ return true;
- bool bChannelMatch(false);
+ bool bChannelMatch = false;
{
CSingleLock lock(m_critSection);
bChannelMatch = (m_channel == right.m_channel);
@@ -108,7 +95,7 @@ bool CPVREpgInfoTag::operator ==(const CPVREpgInfoTag& right) const
return (bChannelMatch &&
m_bNotify == right.m_bNotify &&
m_iClientId == right.m_iClientId &&
- m_iBroadcastId == right.m_iBroadcastId &&
+ m_iDatabaseID == right.m_iDatabaseID &&
m_iGenreType == right.m_iGenreType &&
m_iGenreSubType == right.m_iGenreSubType &&
m_iParentalRating == right.m_iParentalRating &&
@@ -140,14 +127,16 @@ bool CPVREpgInfoTag::operator ==(const CPVREpgInfoTag& right) const
bool CPVREpgInfoTag::operator !=(const CPVREpgInfoTag& right) const
{
- if (this == &right) return false;
+ if (this == &right)
+ return false;
return !(*this == right);
}
void CPVREpgInfoTag::Serialize(CVariant &value) const
{
- CPVRRecordingPtr recording(Recording());
+ const CPVRRecordingPtr recording = Recording();
+
value["broadcastid"] = m_iUniqueBroadcastID;
value["channeluid"] = m_iUniqueChannelID;
value["parentalrating"] = m_iParentalRating;
@@ -184,6 +173,8 @@ void CPVREpgInfoTag::Serialize(CVariant &value) const
void CPVREpgInfoTag::ToSortable(SortItem& sortable, Field field) const
{
+ CSingleLock lock(m_critSection);
+
if (!m_channel)
return;
@@ -241,14 +232,13 @@ bool CPVREpgInfoTag::IsUpcoming(void) const
float CPVREpgInfoTag::ProgressPercentage(void) const
{
- float fReturn(0);
- int iDuration;
+ float fReturn = 0.0f;
+
time_t currentTime, startTime, endTime;
CDateTime::GetCurrentDateTime().GetAsUTCDateTime().GetAsTime(currentTime);
-
m_startTime.GetAsTime(startTime);
m_endTime.GetAsTime(endTime);
- iDuration = endTime - startTime > 0 ? endTime - startTime : 3600;
+ int iDuration = endTime - startTime > 0 ? endTime - startTime : 3600;
if (currentTime >= startTime && currentTime <= endTime)
fReturn = static_cast<float>(currentTime - startTime) * 100.0f / iDuration;
@@ -260,12 +250,11 @@ float CPVREpgInfoTag::ProgressPercentage(void) const
int CPVREpgInfoTag::Progress(void) const
{
- int iDuration;
time_t currentTime, startTime;
CDateTime::GetCurrentDateTime().GetAsUTCDateTime().GetAsTime(currentTime);
-
m_startTime.GetAsTime(startTime);
- iDuration = currentTime - startTime;
+ int iDuration = currentTime - startTime;
+
if (iDuration <= 0)
return 0;
@@ -282,9 +271,9 @@ unsigned int CPVREpgInfoTag::UniqueBroadcastID(void) const
return m_iUniqueBroadcastID;
}
-int CPVREpgInfoTag::BroadcastId(void) const
+int CPVREpgInfoTag::DatabaseID(void) const
{
- return m_iBroadcastId;
+ return m_iDatabaseID;
}
unsigned int CPVREpgInfoTag::UniqueChannelID(void) const
@@ -538,7 +527,8 @@ std::string CPVREpgInfoTag::Path(void) const
bool CPVREpgInfoTag::HasTimer(void) const
{
- return m_timer != NULL;
+ CSingleLock lock(m_critSection);
+ return m_timer != nullptr;
}
bool CPVREpgInfoTag::HasTimerRule(void) const
@@ -549,10 +539,11 @@ bool CPVREpgInfoTag::HasTimerRule(void) const
CPVRTimerInfoTagPtr CPVREpgInfoTag::Timer(void) const
{
+ CSingleLock lock(m_critSection);
return m_timer;
}
-void CPVREpgInfoTag::SetChannel(const PVR::CPVRChannelPtr &channel)
+void CPVREpgInfoTag::SetChannel(const CPVRChannelPtr &channel)
{
CSingleLock lock(m_critSection);
m_channel = channel;
@@ -563,10 +554,10 @@ void CPVREpgInfoTag::SetChannel(const PVR::CPVRChannelPtr &channel)
bool CPVREpgInfoTag::HasChannel(void) const
{
CSingleLock lock(m_critSection);
- return m_channel.get() != NULL;
+ return m_channel != nullptr;
}
-const PVR::CPVRChannelPtr CPVREpgInfoTag::Channel() const
+const CPVRChannelPtr CPVREpgInfoTag::Channel() const
{
CSingleLock lock(m_critSection);
return m_channel;
@@ -574,7 +565,7 @@ const PVR::CPVRChannelPtr CPVREpgInfoTag::Channel() const
bool CPVREpgInfoTag::Update(const CPVREpgInfoTag &tag, bool bUpdateBroadcastId /* = true */)
{
- bool bChanged(false);
+ bool bChanged = false;
{
CSingleLock lock(m_critSection);
bChanged = (m_channel != tag.m_channel);
@@ -613,12 +604,12 @@ bool CPVREpgInfoTag::Update(const CPVREpgInfoTag &tag, bool bUpdateBroadcastId /
m_strSeriesLink != tag.m_strSeriesLink
);
if (bUpdateBroadcastId)
- bChanged |= (m_iBroadcastId != tag.m_iBroadcastId);
+ bChanged |= (m_iDatabaseID != tag.m_iDatabaseID);
if (bChanged)
{
if (bUpdateBroadcastId)
- m_iBroadcastId = tag.m_iBroadcastId;
+ m_iDatabaseID = tag.m_iDatabaseID;
m_iClientId = tag.m_iClientId;
m_strTitle = tag.m_strTitle;
@@ -676,7 +667,7 @@ bool CPVREpgInfoTag::Persist(bool bSingleUpdate /* = true */)
{
bool bReturn = false;
- CPVREpgDatabasePtr database = CServiceBroker::GetPVRManager().EpgContainer().GetEpgDatabase();
+ const CPVREpgDatabasePtr database = CServiceBroker::GetPVRManager().EpgContainer().GetEpgDatabase();
if (!database)
{
CLog::LogF(LOGERROR, "Could not open the EPG database");
@@ -689,7 +680,7 @@ bool CPVREpgInfoTag::Persist(bool bSingleUpdate /* = true */)
bReturn = true;
if (iId > 0)
- m_iBroadcastId = iId;
+ m_iDatabaseID = iId;
}
return bReturn;
@@ -711,11 +702,6 @@ void CPVREpgInfoTag::UpdatePath(void)
m_strFileNameAndPath = StringUtils::Format("pvr://guide/%04i/%s.epg", EpgID(), m_startTime.GetAsDBDateTime().c_str());
}
-const CPVREpg *CPVREpgInfoTag::GetTable() const
-{
- return m_epg;
-}
-
int CPVREpgInfoTag::EpgID(void) const
{
return m_epg ? m_epg->EpgID() : -1;
@@ -723,15 +709,17 @@ int CPVREpgInfoTag::EpgID(void) const
void CPVREpgInfoTag::SetTimer(const CPVRTimerInfoTagPtr &timer)
{
+ CSingleLock lock(m_critSection);
m_timer = timer;
}
void CPVREpgInfoTag::ClearTimer(void)
{
CPVRTimerInfoTagPtr previousTag;
- previousTag = m_timer;
- CPVRTimerInfoTagPtr empty;
- m_timer = empty;
+ {
+ CSingleLock lock(m_critSection);
+ previousTag = std::move(m_timer);
+ }
if (previousTag)
previousTag->ClearEpgTag();
@@ -752,7 +740,7 @@ void CPVREpgInfoTag::ClearRecording(void)
bool CPVREpgInfoTag::HasRecording(void) const
{
CSingleLock lock(m_critSection);
- return m_recording.get() != NULL;
+ return m_recording != nullptr;
}
CPVRRecordingPtr CPVREpgInfoTag::Recording(void) const
@@ -793,19 +781,18 @@ void CPVREpgInfoTag::SetEpg(CPVREpg *epg)
bool CPVREpgInfoTag::IsSeries(void) const
{
- CSingleLock lock(m_critSection);
if ((m_iFlags & EPG_TAG_FLAG_IS_SERIES) > 0 || SeriesNumber() > 0 || EpisodeNumber() > 0 || EpisodePart() > 0)
return true;
else
return false;
}
-const std::vector<std::string> CPVREpgInfoTag::Tokenize(const std::string &str) const
+const std::vector<std::string> CPVREpgInfoTag::Tokenize(const std::string &str)
{
return StringUtils::Split(str.c_str(), EPG_STRING_TOKEN_SEPARATOR);
}
-const std::string CPVREpgInfoTag::DeTokenize(const std::vector<std::string> &tokens) const
+const std::string CPVREpgInfoTag::DeTokenize(const std::vector<std::string> &tokens)
{
return StringUtils::Join(tokens, EPG_STRING_TOKEN_SEPARATOR);
}
diff --git a/xbmc/pvr/epg/EpgInfoTag.h b/xbmc/pvr/epg/EpgInfoTag.h
index eb3dac4f00..75625d2543 100644
--- a/xbmc/pvr/epg/EpgInfoTag.h
+++ b/xbmc/pvr/epg/EpgInfoTag.h
@@ -35,34 +35,24 @@ namespace PVR
public:
/*!
- * @brief Create a new empty event .
- */
- static CPVREpgInfoTagPtr CreateDefaultTag();
-
- /*!
- * @brief Create a new EPG infotag with 'data' as content.
- * @param data The tag's content.
+ * @brief Create a new EPG infotag.
+ * @param data The tag's data.
+ * @param iClientId The client id.
*/
CPVREpgInfoTag(const EPG_TAG &data, int iClientId);
- private:
- /*!
- * @brief Create a new empty event.
- */
- CPVREpgInfoTag(void);
-
/*!
- * @brief Create a new empty event without a unique ID.
+ * @brief Create a new EPG infotag.
+ * @param channel The channel.
+ * @param epg The epg data.
+ * @param strTabelName The name of the epg database table.
*/
- CPVREpgInfoTag(CPVREpg *epg, const PVR::CPVRChannelPtr &channel, const std::string &strTableName = "", const std::string &strIconPath = "");
-
- CPVREpgInfoTag(const CPVREpgInfoTag &tag) = delete;
- CPVREpgInfoTag &operator =(const CPVREpgInfoTag &other) = delete;
+ CPVREpgInfoTag(const CPVRChannelPtr &channel, CPVREpg *epg = nullptr, const std::string &strTableName = "");
- public:
bool operator ==(const CPVREpgInfoTag& right) const;
bool operator !=(const CPVREpgInfoTag& right) const;
+ // ISerializable implementation
void Serialize(CVariant &value) const override;
// ISortable implementation
@@ -81,36 +71,38 @@ namespace PVR
bool IsActive(void) const;
/*!
+ * @brief Check if this event is in the past.
* @return True when this event has already passed, false otherwise.
*/
bool WasActive(void) const;
/*!
+ * @brief Check if this event is in the future.
* @return True when this event is an upcoming event, false otherwise.
*/
bool IsUpcoming(void) const;
/*!
+ * @brief Get the progress of this tag in percent.
* @return The current progress of this tag.
*/
float ProgressPercentage(void) const;
/*!
+ * @brief Get the progress of this tag in seconds.
* @return The current progress of this tag in seconds.
*/
int Progress(void) const;
/*!
- * @brief The table this event belongs to
- * @return The table this event belongs to
+ * @brief Get EPG ID of this tag.
+ * @return The epg ID.
*/
- const CPVREpg *GetTable() const;
-
int EpgID(void) const;
/*!
- * @brief Sets the epg reference of this event
- * @param epg The epg item
+ * @brief Sets the EPG for this event.
+ * @param epg The epg.
*/
void SetEpg(CPVREpg *epg);
@@ -130,26 +122,36 @@ namespace PVR
* @brief Get the event's database ID.
* @return The database ID.
*/
- int BroadcastId(void) const;
+ int DatabaseID(void) const;
/*!
- * @brief Get the unique ID of the channel this event belongs to.
+ * @brief Get the unique ID of the channel associated with this event.
* @return The unique channel ID.
*/
unsigned int UniqueChannelID(void) const;
/*!
* @brief Get the event's start time.
- * @return The new start time.
+ * @return The start time in UTC.
*/
CDateTime StartAsUTC(void) const;
+
+ /*!
+ * @brief Get the event's start time.
+ * @return The start time as local time.
+ */
CDateTime StartAsLocalTime(void) const;
/*!
* @brief Get the event's end time.
- * @return The new start time.
+ * @return The end time in UTC.
*/
CDateTime EndAsUTC(void) const;
+
+ /*!
+ * @brief Get the event's end time.
+ * @return The end time as local time.
+ */
CDateTime EndAsLocalTime(void) const;
/*!
@@ -160,17 +162,11 @@ namespace PVR
/*!
* @brief Get the duration of this event in seconds.
- * @return The duration in seconds.
+ * @return The duration.
*/
int GetDuration(void) const;
/*!
- * @brief Check whether this event is parental locked.
- * @return True if whether this event is parental locked, false otherwise.
- */
- bool IsParentalLocked() const;
-
- /*!
* @brief Get the title of this event.
* @param bOverrideParental True to override parental control, false to check it.
* @return The title.
@@ -272,9 +268,14 @@ namespace PVR
/*!
* @brief Get the first air date of this event.
- * @return The first air date.
+ * @return The first air date in UTC.
*/
CDateTime FirstAiredAsUTC(void) const;
+
+ /*!
+ * @brief Get the first air date of this event.
+ * @return The first air date as local time.
+ */
CDateTime FirstAiredAsLocalTime(void) const;
/*!
@@ -342,7 +343,7 @@ namespace PVR
* @brief Set a timer for this event.
* @param timer The timer.
*/
- void SetTimer(const PVR::CPVRTimerInfoTagPtr &timer);
+ void SetTimer(const CPVRTimerInfoTagPtr &timer);
/*!
* @brief Clear the timer for this event.
@@ -350,28 +351,28 @@ namespace PVR
void ClearTimer(void);
/*!
- * @brief Check whether this event has an active timer tag.
- * @return True if it has an active timer tag, false if not.
+ * @brief Check whether this event has a timer tag.
+ * @return True if it has a timer tag, false if not.
*/
bool HasTimer(void) const;
/*!
- * @brief Check whether this event has an active timer rule.
- * @return True if it has an active timer rule, false if not.
+ * @brief Check whether this event has a timer rule.
+ * @return True if it has a timer rule, false if not.
*/
bool HasTimerRule(void) const;
/*!
- * @brief Get a pointer to the timer for event or NULL if there is none.
- * @return A pointer to the timer for event or NULL if there is none.
+ * @brief Get the timer for this event, if any.
+ * @return The timer or nullptr if there is none.
*/
- PVR::CPVRTimerInfoTagPtr Timer(void) const;
+ CPVRTimerInfoTagPtr Timer(void) const;
/*!
- * @brief Set a recording for this event or NULL to clear it.
- * @param recording The recording value.
+ * @brief Set a recording for this event.
+ * @param recording The recording.
*/
- void SetRecording(const PVR::CPVRRecordingPtr &recording);
+ void SetRecording(const CPVRRecordingPtr &recording);
/*!
* @brief Clear a recording for this event.
@@ -379,16 +380,16 @@ namespace PVR
void ClearRecording(void);
/*!
- * @brief Check whether this event has a recording tag.
- * @return True if it has a recording tag, false if not.
+ * @brief Check whether this event has a recording.
+ * @return True if it has a recording, false if not.
*/
bool HasRecording(void) const;
/*!
- * @brief Get a pointer to the recording for event or NULL if there is none.
- * @return A pointer to the recording for event or NULL if there is none.
+ * @brief Get the recording for this event, if any.
+ * @return The pointer or nullptr if there is none.
*/
- PVR::CPVRRecordingPtr Recording(void) const;
+ CPVRRecordingPtr Recording(void) const;
/*!
* @brief Check if this event can be recorded.
@@ -403,21 +404,22 @@ namespace PVR
bool IsPlayable(void) const;
/*!
- * @brief Change the channel tag of this epg tag
- * @param channel The new channel
+ * @brief Set the channel of this epg tag
+ * @param channel The channel
*/
- void SetChannel(const PVR::CPVRChannelPtr &channel);
+ void SetChannel(const CPVRChannelPtr &channel);
/*!
- * @return True if this tag has a PVR channel set.
+ * @brief Check whether this event has a channel.
+ * @return True if it has a channel, false if not.
*/
bool HasChannel(void) const;
/*!
- * @brief Get the channel that plays this event.
- * @return a pointer to the channel.
+ * @brief Get the channel for this event.
+ * @return The channel.
*/
- const PVR::CPVRChannelPtr Channel(void) const;
+ const CPVRChannelPtr Channel(void) const;
/*!
* @brief Persist this tag in the database.
@@ -441,6 +443,7 @@ namespace PVR
std::vector<PVR_EDL_ENTRY> GetEdl() const;
/*!
+ * @brief Check whether this tag has any series attributes.
* @return True if this tag has any series attributes, false otherwise
*/
bool IsSeries() const;
@@ -456,16 +459,27 @@ namespace PVR
* @param str The string to tokenize.
* @return the tokens.
*/
- const std::vector<std::string> Tokenize(const std::string &str) const;
+ static const std::vector<std::string> Tokenize(const std::string &str);
/*!
* @brief Combine the given strings to a single string. Inserts EPG_STRING_TOKEN_SEPARATOR as separator.
* @param tokens The tokens.
* @return the combined string.
*/
- const std::string DeTokenize(const std::vector<std::string> &tokens) const;
+ static const std::string DeTokenize(const std::vector<std::string> &tokens);
private:
+ CPVREpgInfoTag() = default;
+
+ CPVREpgInfoTag(const CPVREpgInfoTag &tag) = delete;
+ CPVREpgInfoTag &operator =(const CPVREpgInfoTag &other) = delete;
+
+ /*!
+ * @brief Check whether this event is parental locked.
+ * @return True if whether this event is parental locked, false otherwise.
+ */
+ bool IsParentalLocked() const;
+
/*!
* @brief Change the genre of this event.
* @param iGenreType The genre type ID.
@@ -474,53 +488,51 @@ namespace PVR
void SetGenre(int iGenreType, int iGenreSubType, const char* strGenre);
/*!
- * @brief Hook that is called when the start date changed.
+ * @brief Update the path of this tag.
*/
void UpdatePath(void);
/*!
* @brief Get current time, taking timeshifting into account.
+ * @return The playing time.
*/
CDateTime GetCurrentPlayingTime(void) const;
- bool m_bNotify = false; /*!< notify on start */
- int m_iClientId = -1; /*!< client id */
- int m_iBroadcastId = -1; /*!< database ID */
- int m_iGenreType = 0; /*!< genre type */
- int m_iGenreSubType = 0; /*!< genre subtype */
- int m_iParentalRating = 0; /*!< parental rating */
- int m_iStarRating = 0; /*!< star rating */
- int m_iSeriesNumber = 0; /*!< series number */
- int m_iEpisodeNumber = 0; /*!< episode number */
- int m_iEpisodePart = 0; /*!< episode part number */
- unsigned int m_iUniqueBroadcastID; /*!< unique broadcast ID */
- unsigned int m_iUniqueChannelID; /*!< unique channel ID */
- std::string m_strTitle; /*!< title */
- std::string m_strPlotOutline; /*!< plot outline */
- std::string m_strPlot; /*!< plot */
- std::string m_strOriginalTitle; /*!< original title */
- std::vector<std::string> m_cast; /*!< cast */
- std::vector<std::string> m_directors; /*!< director(s) */
- std::vector<std::string> m_writers; /*!< writer(s) */
- int m_iYear = 0; /*!< year */
- std::string m_strIMDBNumber; /*!< imdb number */
- std::vector<std::string> m_genre; /*!< genre */
- std::string m_strEpisodeName; /*!< episode name */
- std::string m_strIconPath; /*!< the path to the icon */
- std::string m_strFileNameAndPath; /*!< the filename and path */
- CDateTime m_startTime; /*!< event start time */
- CDateTime m_endTime; /*!< event end time */
- CDateTime m_firstAired; /*!< first airdate */
-
- PVR::CPVRTimerInfoTagPtr m_timer;
-
- CPVREpg * m_epg = nullptr; /*!< the schedule that this event belongs to */
-
- unsigned int m_iFlags; /*!< the flags applicable to this EPG entry */
- std::string m_strSeriesLink; /*!< series link */
+ bool m_bNotify = false; /*!< notify on start */
+ int m_iClientId = -1; /*!< client id */
+ int m_iDatabaseID = -1; /*!< database ID */
+ int m_iGenreType = 0; /*!< genre type */
+ int m_iGenreSubType = 0; /*!< genre subtype */
+ int m_iParentalRating = 0; /*!< parental rating */
+ int m_iStarRating = 0; /*!< star rating */
+ int m_iSeriesNumber = 0; /*!< series number */
+ int m_iEpisodeNumber = 0; /*!< episode number */
+ int m_iEpisodePart = 0; /*!< episode part number */
+ unsigned int m_iUniqueBroadcastID = EPG_TAG_INVALID_UID; /*!< unique broadcast ID */
+ unsigned int m_iUniqueChannelID = PVR_CHANNEL_INVALID_UID; /*!< unique channel ID */
+ std::string m_strTitle; /*!< title */
+ std::string m_strPlotOutline; /*!< plot outline */
+ std::string m_strPlot; /*!< plot */
+ std::string m_strOriginalTitle; /*!< original title */
+ std::vector<std::string> m_cast; /*!< cast */
+ std::vector<std::string> m_directors; /*!< director(s) */
+ std::vector<std::string> m_writers; /*!< writer(s) */
+ int m_iYear = 0; /*!< year */
+ std::string m_strIMDBNumber; /*!< imdb number */
+ std::vector<std::string> m_genre; /*!< genre */
+ std::string m_strEpisodeName; /*!< episode name */
+ std::string m_strIconPath; /*!< the path to the icon */
+ std::string m_strFileNameAndPath; /*!< the filename and path */
+ CDateTime m_startTime; /*!< event start time */
+ CDateTime m_endTime; /*!< event end time */
+ CDateTime m_firstAired; /*!< first airdate */
+ unsigned int m_iFlags = EPG_TAG_FLAG_UNDEFINED; /*!< the flags applicable to this EPG entry */
+ std::string m_strSeriesLink; /*!< series link */
mutable CCriticalSection m_critSection;
- PVR::CPVRChannelPtr m_channel;
- PVR::CPVRRecordingPtr m_recording;
+ CPVREpg *m_epg = nullptr;
+ CPVRChannelPtr m_channel;
+ CPVRTimerInfoTagPtr m_timer;
+ CPVRRecordingPtr m_recording;
};
}
diff --git a/xbmc/pvr/windows/GUIEPGGridContainerModel.cpp b/xbmc/pvr/windows/GUIEPGGridContainerModel.cpp
index e6d5c65176..b67f752490 100644
--- a/xbmc/pvr/windows/GUIEPGGridContainerModel.cpp
+++ b/xbmc/pvr/windows/GUIEPGGridContainerModel.cpp
@@ -204,9 +204,8 @@ void CGUIEPGGridContainerModel::Initialize(const std::unique_ptr<CFileItemList>
}
else
{
- CPVREpgInfoTagPtr gapTag(CPVREpgInfoTag::CreateDefaultTag());
- gapTag->SetChannel(m_channelItems[channel]->GetPVRChannelInfoTag());
- CFileItemPtr gapItem(new CFileItem(gapTag));
+ const CPVREpgInfoTagPtr gapTag(new CPVREpgInfoTag(m_channelItems[channel]->GetPVRChannelInfoTag()));
+ const CFileItemPtr gapItem(new CFileItem(gapTag));
for (int i = block + blockDelta; i >= block - itemSize + sizeDelta; --i)
{
m_gridIndex[channel][i].item = gapItem;
@@ -229,9 +228,8 @@ void CGUIEPGGridContainerModel::Initialize(const std::unique_ptr<CFileItemList>
}
else
{
- CPVREpgInfoTagPtr gapTag(CPVREpgInfoTag::CreateDefaultTag());
- gapTag->SetChannel(m_channelItems[channel]->GetPVRChannelInfoTag());
- CFileItemPtr gapItem(new CFileItem(gapTag));
+ const CPVREpgInfoTagPtr gapTag(new CPVREpgInfoTag(m_channelItems[channel]->GetPVRChannelInfoTag()));
+ const CFileItemPtr gapItem(new CFileItem(gapTag));
m_gridIndex[channel][block].item = gapItem;
}