From 7419b1f522612cd05d1d9995bf355d728d9a7e5a Mon Sep 17 00:00:00 2001 From: Jasmin Jessich Date: Sun, 11 Jun 2017 18:49:27 +0200 Subject: 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. --- recman.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'recman.cpp') 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 -- cgit v1.2.3