diff options
author | Lars Hanisch <dvb@flensrocker.de> | 2011-09-21 23:38:24 +0200 |
---|---|---|
committer | Lars Hanisch <dvb@flensrocker.de> | 2011-09-22 00:11:01 +0200 |
commit | 835f90524b4d86e1e572cda3ca751509457ba285 (patch) | |
tree | cbaf7a7ae789bbec1a35b0701df1b0b4a116a266 /dynamicdevice.c | |
parent | b130eca01d7c3ae0e4e8ce1475448958e86a8bcc (diff) | |
download | vdr-plugin-dynamite-835f90524b4d86e1e572cda3ca751509457ba285.tar.gz vdr-plugin-dynamite-835f90524b4d86e1e572cda3ca751509457ba285.tar.bz2 |
add SVDRP/Service commands SetIdleTimeout and SetIdleWakeup to modify the values on the fly
Diffstat (limited to 'dynamicdevice.c')
-rw-r--r-- | dynamicdevice.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/dynamicdevice.c b/dynamicdevice.c index ce4db50..a5817c7 100644 --- a/dynamicdevice.c +++ b/dynamicdevice.c @@ -343,21 +343,22 @@ void cDynamicDevice::AutoIdle(void) cMutexLock lock(&arrayMutex); time_t now = time(NULL); bool wokeupSomeDevice = false; + int seconds = 0; for (int i = 0; i < numDynamicDevices; i++) { if (dynamicdevice[i]->devpath != NULL) { if (dynamicdevice[i]->IsIdle()) { - int hours = (now - dynamicdevice[i]->idleSince) / 3600; - if ((dynamicdevice[i]->idleSince > 0) && (hours >= idleWakeupHours)) { - isyslog("dynamite: device %s idle for %d hours, waking up", dynamicdevice[i]->GetDevPath(), hours); + seconds = now - dynamicdevice[i]->idleSince; + if ((dynamicdevice[i]->idleSince > 0) && (seconds >= (idleWakeupHours * 3600))) { + isyslog("dynamite: device %s idle for %d hours, waking up", dynamicdevice[i]->GetDevPath(), seconds / 3600); cDynamicDeviceProbe::QueueDynamicDeviceCommand(ddpcService, *cString::sprintf("dynamite-SetNotIdle-v0.1 %s", dynamicdevice[i]->GetDevPath())); wokeupSomeDevice = true; } } else { - int minutes = (now - dynamicdevice[i]->lastCloseDvr) / 60; - if ((dynamicdevice[i]->lastCloseDvr > 0) && (minutes >= idleTimeoutMinutes)) { + seconds = now - dynamicdevice[i]->lastCloseDvr; + if ((dynamicdevice[i]->lastCloseDvr > 0) && (seconds >= (idleTimeoutMinutes * 60))) { if (dynamicdevice[i]->lastCloseDvr > 0) - isyslog("dynamite: device %s unused for %d minutes, set to idle", dynamicdevice[i]->GetDevPath(), minutes); + isyslog("dynamite: device %s unused for %d minutes, set to idle", dynamicdevice[i]->GetDevPath(), seconds / 60); else isyslog("dynamite: device %s never used , set to idle", dynamicdevice[i]->GetDevPath()); cDynamicDeviceProbe::QueueDynamicDeviceCommand(ddpcService, *cString::sprintf("dynamite-SetIdle-v0.1 %s", dynamicdevice[i]->GetDevPath())); |