summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave <vdr@pickles.me.uk>2012-07-07 13:27:33 +0100
committerDave <vdr@pickles.me.uk>2012-07-07 13:27:33 +0100
commit20882fc6759c82881dbb21de1bbcd4442596584f (patch)
tree22aaa5d559ce8091e0a09731a23f34908e231710
parentbead2041a548fb27533d6ad0d55841c60f8a45bb (diff)
downloadvdrtva-20882fc6759c82881dbb21de1bbcd4442596584f.tar.gz
vdrtva-20882fc6759c82881dbb21de1bbcd4442596584f.tar.bz2
Delay collection to allow other plugins to start first.
-rw-r--r--TODO2
-rw-r--r--vdrtva.c16
2 files changed, 15 insertions, 3 deletions
diff --git a/TODO b/TODO
index 16b16d0..30a91a1 100644
--- a/TODO
+++ b/TODO
@@ -14,6 +14,8 @@ Display suggestions for timers which don't have series CRIDs.
OSD for managing series links (work in progress).
+Option to select which device to use for CRID collection.
+
Bugs:
Very rare crash 'pure virtual method called' in plugin - possibly solved.
Spurious timer clash report - seen once, cause unknown.
diff --git a/vdrtva.c b/vdrtva.c
index 7362900..0884de7 100644
--- a/vdrtva.c
+++ b/vdrtva.c
@@ -34,6 +34,7 @@ int priority; // Priority of series link recordings (default 99)
int seriesLifetime; // Expiry time of a series link (default 30 days)
int updatetime; // Time to carry out the series link update HHMM (default 03:00)
bool captureComplete; // Flag set if initial CRID capture has completed.
+time_t startTime; // Time the plugin was initialised.
class cPluginvdrTva : public cPlugin {
@@ -97,6 +98,7 @@ cPluginvdrTva::cPluginvdrTva(void)
collectionperiod = 10 * 60;
updatetime = 300;
captureComplete = false;
+ startTime = time(NULL);
}
cPluginvdrTva::~cPluginvdrTva()
@@ -199,8 +201,7 @@ bool cPluginvdrTva::Start(void)
esyslog("vdrtva: no mail server found");
}
}
- StartDataCapture();
- nextactiontime = time(NULL) + collectionperiod; // wait for CRIDs to be collected
+ nextactiontime = time(NULL) + collectionperiod + 1; // wait for CRIDs to be collected
return true;
}
@@ -225,7 +226,6 @@ void cPluginvdrTva::Housekeeping(void)
statusMonitor->ClearTimerAdded(); // Ignore any timer changes while update is in progress
switch (state) {
case 0:
- captureComplete = true;
Expire();
Update();
state++;
@@ -269,6 +269,16 @@ void cPluginvdrTva::MainThreadHook(void)
{
// Perform actions in the context of the main program thread.
// WARNING: Use with great care - see PLUGINS.html!
+
+ static bool running = false;
+
+ if (!running && (time(NULL) - startTime > 5)) {
+ StartDataCapture();
+ running = true;
+ }
+ if (!captureComplete && (time(NULL) - startTime > collectionperiod)) {
+ captureComplete = true;
+ }
}
cString cPluginvdrTva::Active(void)