summaryrefslogtreecommitdiff
path: root/timers.cpp
diff options
context:
space:
mode:
authorSascha Volkenandt <sascha (at) akv-soft (dot) de>2007-01-05 17:52:00 +0000
committerSascha Volkenandt <sascha (at) akv-soft (dot) de>2007-01-05 17:52:00 +0000
commit93f1c156edfd067627cd969ca275f38d3b319069 (patch)
treedcad5da03d5f1073e44cf074d7207585b81cd270 /timers.cpp
parent5db7bc2bcf45e33e0cd1f58042751d69f29a4023 (diff)
downloadvdr-plugin-live-93f1c156edfd067627cd969ca275f38d3b319069.tar.gz
vdr-plugin-live-93f1c156edfd067627cd969ca275f38d3b319069.tar.bz2
- moved SortedTimers to plugin and added methods to interface from website
- added function to update internal timers from main thread
Diffstat (limited to 'timers.cpp')
-rw-r--r--timers.cpp42
1 files changed, 42 insertions, 0 deletions
diff --git a/timers.cpp b/timers.cpp
index ea3d6d1..e1689ce 100644
--- a/timers.cpp
+++ b/timers.cpp
@@ -1,9 +1,51 @@
+#include <sstream>
#include "timers.h"
+static bool operator<( cTimer const& left, cTimer const& right )
+{
+ return left.Compare( right ) < 0;
+}
+
namespace vdrlive {
+using namespace std;
+
+SortedTimers::SortedTimers():
+ m_state( 0 )
+{
+ ReloadTimers( true );
+}
+
+string SortedTimers::GetTimerId( cTimer const& timer )
+{
+ ostringstream builder;
+ builder << *timer.Channel()->GetChannelID().ToString() << ":" << timer.WeekDays() << ":"
+ << timer.Day() << ":" << timer.Start() << ":" << timer.Stop();
+ return builder.str();
+}
+
+void SortedTimers::ReloadTimers( bool initial )
+{
+ if ( !Timers.Modified( m_state ) && !initial )
+ return;
+
+ dsyslog("reloading timers");
+
+ clear();
+ for ( cTimer* timer = Timers.First(); timer != 0; timer = Timers.Next( timer ) ) {
+ push_back( *timer );
+ }
+ sort();
+}
+
TimerManager::TimerManager()
{
}
+void TimerManager::DoPendingWork()
+{
+ cMutexLock lock( this );
+ m_timers.ReloadTimers();
+}
+
} // namespace vdrlive