diff options
-rw-r--r-- | recman.cpp | 19 | ||||
-rw-r--r-- | recman.h | 4 |
2 files changed, 20 insertions, 3 deletions
@@ -26,7 +26,8 @@ namespace vdrlive { shared_ptr< RecordingsTree > RecordingsManager::m_recTree; shared_ptr< RecordingsList > RecordingsManager::m_recList; shared_ptr< DirectoryList > RecordingsManager::m_recDirs; - int RecordingsManager::m_recordingsState = 0; + time_t RecordingsManager::m_recordingsState = 0; + string RecordingsManager::m_UpdateFileName; // The RecordingsManager holds a VDR lock on the // Recordings. Additionally the singleton instance of @@ -256,6 +257,20 @@ namespace vdrlive { return archived; } +#if VDRVERSNUM >= 20301 + bool RecordingsManager::StateChanged (time_t& tm) + { + if (m_UpdateFileName.empty()) { + m_UpdateFileName = AddDirectory (cVideoDirectory::Name(), ".update"); + } + LOCK_RECORDINGS_READ; + time_t lastmod = LastModifiedTime (m_UpdateFileName.c_str()); + bool result = tm != lastmod; + tm = lastmod; + return result; + } +#endif + RecordingsManagerPtr RecordingsManager::EnsureValidData() { // Get singleton instance of RecordingsManager. 'this' is not @@ -272,7 +287,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 = true; + bool stateChanged = StateChanged (m_recordingsState); #else bool stateChanged = Recordings.StateChanged(m_recordingsState); #endif @@ -119,13 +119,15 @@ namespace vdrlive { private: RecordingsManager(); + static bool StateChanged (time_t& tm); static RecordingsManagerPtr EnsureValidData(); static std::tr1::weak_ptr< RecordingsManager > m_recMan; static std::tr1::shared_ptr< RecordingsTree > m_recTree; static std::tr1::shared_ptr< RecordingsList > m_recList; static std::tr1::shared_ptr< DirectoryList > m_recDirs; - static int m_recordingsState; + static time_t m_recordingsState; + static std::string m_UpdateFileName; cThreadLock m_recordingsLock; }; |