aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKai Sommerfeld <kai.sommerfeld@gmx.com>2020-02-06 22:08:51 +0100
committerKai Sommerfeld <kai.sommerfeld@gmx.com>2020-02-07 18:35:58 +0100
commitaf14f6d4e2bc36162198984de804e6204451b62d (patch)
treec34c4910e8addba49cf75b5b314bea8a4f1f2bcc
parentd6ce2becac1bc400cc2d8b2bc0d631878fcabd69 (diff)
[PVR] CPVREpg: Fix EPG not saved for newly added channels.
-rw-r--r--xbmc/pvr/epg/Epg.cpp11
-rw-r--r--xbmc/pvr/epg/Epg.h1
2 files changed, 8 insertions, 4 deletions
diff --git a/xbmc/pvr/epg/Epg.cpp b/xbmc/pvr/epg/Epg.cpp
index c60712351a..37c9b526fa 100644
--- a/xbmc/pvr/epg/Epg.cpp
+++ b/xbmc/pvr/epg/Epg.cpp
@@ -44,7 +44,8 @@ CPVREpg::CPVREpg(int iEpgID,
const std::string& strScraperName,
const std::shared_ptr<CPVREpgChannelData>& channelData,
const std::shared_ptr<CPVREpgDatabase>& database)
- : m_iEpgID(iEpgID),
+ : m_bChanged(true),
+ m_iEpgID(iEpgID),
m_strName(strName),
m_strScraperName(strScraperName),
m_channelData(channelData),
@@ -303,7 +304,7 @@ bool CPVREpg::Persist(const std::shared_ptr<CPVREpgDatabase>& database)
{
CSingleLock lock(m_critSection);
bool bEpgIdChanged = false;
- if (m_iEpgID <= 0)
+ if (m_iEpgID <= 0 || m_bChanged)
{
int iId = database->Persist(*this, m_iEpgID > 0);
if (iId > 0 && m_iEpgID != iId)
@@ -313,7 +314,8 @@ bool CPVREpg::Persist(const std::shared_ptr<CPVREpgDatabase>& database)
}
}
- m_tags.Persist(false);
+ if (m_tags.NeedsSave())
+ m_tags.Persist(false);
if (m_bUpdateLastScanTime)
database->PersistLastEpgScanTime(m_iEpgID, m_lastScanTime, true);
@@ -321,6 +323,7 @@ bool CPVREpg::Persist(const std::shared_ptr<CPVREpgDatabase>& database)
if (bEpgIdChanged)
m_tags.SetEpgID(m_iEpgID);
+ m_bChanged = false;
m_bUpdateLastScanTime = false;
}
@@ -500,7 +503,7 @@ bool CPVREpg::UpdatePending() const
bool CPVREpg::NeedsSave() const
{
CSingleLock lock(m_critSection);
- return m_tags.NeedsSave();
+ return m_bChanged || m_tags.NeedsSave();
}
bool CPVREpg::IsValid() const
diff --git a/xbmc/pvr/epg/Epg.h b/xbmc/pvr/epg/Epg.h
index 332e69dc28..ce93ac507e 100644
--- a/xbmc/pvr/epg/Epg.h
+++ b/xbmc/pvr/epg/Epg.h
@@ -289,6 +289,7 @@ namespace PVR
*/
void Cleanup(int iPastDays);
+ bool m_bChanged = false; /*!< true if anything changed that needs to be persisted, false otherwise */
bool m_bUpdatePending = false; /*!< true if manual update is pending */
int m_iEpgID = 0; /*!< the database ID of this table */
std::string m_strName; /*!< the name of this table */