diff options
author | Jasmin Jessich <jasmin@anw.at> | 2017-05-14 00:49:10 +0200 |
---|---|---|
committer | Jasmin Jessich <jasmin@anw.at> | 2017-05-14 00:49:10 +0200 |
commit | 98de50e14c3c9f3189f9603dceea13050f5560ba (patch) | |
tree | c1e7ecc6f8d1841c9c2fc03d05338e356685adfa | |
parent | 9e0e251e13854f7389502d5becc8e5b8234f8a7b (diff) | |
download | vdr-plugin-live-98de50e14c3c9f3189f9603dceea13050f5560ba.tar.gz vdr-plugin-live-98de50e14c3c9f3189f9603dceea13050f5560ba.tar.bz2 |
Added RecordingsManager::StateChanged
-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; }; |