summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJasmin Jessich <jasmin@anw.at>2017-06-11 18:49:27 +0200
committerJasmin Jessich <jasmin@anw.at>2017-06-15 23:57:09 +0200
commit7419b1f522612cd05d1d9995bf355d728d9a7e5a (patch)
treed6a90bc1ae78d095856f576f6feed543781e0028
parent81139eddb642f4567151ebe98656ef67a72bd9d3 (diff)
downloadvdr-plugin-live-7419b1f522612cd05d1d9995bf355d728d9a7e5a.tar.gz
vdr-plugin-live-7419b1f522612cd05d1d9995bf355d728d9a7e5a.tar.bz2
Use a cStateKey for recordings changed detection
- Added RecordingsManager::m_recordingsStateKey to store the last recordings list state. - RecordingsManager::StateChanged uses now the new m_recordingsStateKey to check, if the list has been modified.
-rw-r--r--recman.cpp20
-rw-r--r--recman.h5
2 files changed, 12 insertions, 13 deletions
diff --git a/recman.cpp b/recman.cpp
index fe0bc72..71730d0 100644
--- a/recman.cpp
+++ b/recman.cpp
@@ -27,8 +27,7 @@ namespace vdrlive {
std::tr1::shared_ptr< RecordingsList > RecordingsManager::m_recList;
std::tr1::shared_ptr< DirectoryList > RecordingsManager::m_recDirs;
#if VDRVERSNUM >= 20301
- time_t RecordingsManager::m_recordingsState = 0;
- string RecordingsManager::m_UpdateFileName;
+ cStateKey RecordingsManager::m_recordingsStateKey;
#else
int RecordingsManager::m_recordingsState = 0;
#endif
@@ -262,15 +261,16 @@ namespace vdrlive {
}
#if VDRVERSNUM >= 20301
- bool RecordingsManager::StateChanged (time_t& tm)
+ bool RecordingsManager::StateChanged ()
{
- if (m_UpdateFileName.empty()) {
- m_UpdateFileName = AddDirectory (cVideoDirectory::Name(), ".update");
+ bool result = false;
+
+ // will return != 0 only, if the Recordings List has been changed since last read
+ if (cRecordings::GetRecordingsRead(m_recordingsStateKey)) {
+ result = true;
+ m_recordingsStateKey.Remove();
}
- LOCK_RECORDINGS_READ;
- time_t lastmod = LastModifiedTime (m_UpdateFileName.c_str());
- bool result = tm != lastmod;
- tm = lastmod;
+
return result;
}
#endif
@@ -291,7 +291,7 @@ namespace vdrlive {
// StateChanged must be executed every time, so not part of
// the short cut evaluation in the if statement below.
#if VDRVERSNUM >= 20301
- bool stateChanged = StateChanged (m_recordingsState);
+ bool stateChanged = StateChanged();
#else
bool stateChanged = Recordings.StateChanged(m_recordingsState);
#endif
diff --git a/recman.h b/recman.h
index 75f2adf..d9810b9 100644
--- a/recman.h
+++ b/recman.h
@@ -123,7 +123,7 @@ namespace vdrlive {
RecordingsManager();
#if VDRVERSNUM >= 20301
- static bool StateChanged (time_t& tm);
+ static bool StateChanged();
#endif
static RecordingsManagerPtr EnsureValidData();
@@ -132,8 +132,7 @@ namespace vdrlive {
static std::tr1::shared_ptr< RecordingsList > m_recList;
static std::tr1::shared_ptr< DirectoryList > m_recDirs;
#if VDRVERSNUM >= 20301
- static time_t m_recordingsState;
- static std::string m_UpdateFileName;
+ static cStateKey m_recordingsStateKey;
#else
static int m_recordingsState;
#endif