[vdr] suggestion for shutdown-handling
geronimo
geronimo013 at gmx.de
Thu Mar 2 08:49:52 CET 2006
Hello,
I hope it's OK to post this kind of things (it's my first post here).
First I thought about a plugin, which handles all the shutdown-questions,
which are spread around in various shutdown-scripts and extensions.
... but a (normal) plugin is not able to prevent vdr from shutdown.
Patching vdr is one point, but on the other side I read a statement from
LinVDR, that they won't use patched VDR (which is quite ok from my point of
view).
As I'm a fan of LinVDR, I looked for a way of doing it right.
AFAIK there are 2 possibilities:
1. change the interface of plugin- and pluginmanager-class
2. add a new mode of operation to vdr.
I think the first point was already discussed in the past, so I looked on how
to solve the second.
The vdr could distinguish between LiveTV (usage as settop-box) and
recording-mode (usage as a video-recorder).
In settop-box-mode the user has to care about power-on and power-off - in
video-recorder-mode it's up to the vdr to care about power-state.
The state could be implemented this way (diff -Naur vdr.org.c vdr.c):
* * * * * * * start of diff * * * * * *
--- vdr.org.c 2006-03-02 08:15:41.052766272 +0100
+++ vdr.c 2006-03-02 08:22:40.933934632 +0100
@@ -176,6 +176,7 @@
bool DisplayHelp = false;
bool DisplayVersion = false;
bool DaemonMode = false;
+ bool LiveTvMode = false;
int SysLogTarget = LOG_USER;
bool MuteAudio = false;
int WatchdogTimeout = DEFAULTWATCHDOG;
@@ -930,6 +931,10 @@
Skins.Message(mtError, tr("Can't shutdown - option
'-s' not given!"));
break;
}
+ if (LiveTvMode) {
+ LiveTvMode = false;
+ break;
+ }
if (cRecordControls::Active()) {
if (Interface->Confirm(tr("Recording - shut down
anyway?")))
ForceShutdown = true;
@@ -1047,7 +1052,7 @@
Skins.Message(mtInfo, tr("Editing process finished"));
}
}
- if (!Interact && ((!cRecordControls::Active() && !cCutter::Active()
&& (!Interface->HasSVDRPConnection() || UserShutdown)) || ForceShutdown)) {
+ if (!LiveTvMode && !Interact && ((!cRecordControls::Active()
&& !cCutter::Active() && (!Interface->HasSVDRPConnection() || UserShutdown))
|| ForceShutdown)) {
time_t Now = time(NULL);
if (Now - LastActivity > ACTIVITYTIMEOUT) {
// Shutdown:
@@ -1060,6 +1065,7 @@
// Apparently the user started VDR manually
dsyslog("assuming manual start of VDR");
LastActivity = Now;
+ LiveTvMode = true;
continue; // don't run into the actual shutdown
procedure below
}
else
* * * * * * * end of diff * * * * * *
To suport plugins changing the operating mode, the var LiveTvMode could be
made static with provided setter and getter.
So the plugins could change the mode and the user is stil able to overwrite
the mode and shutdown the vdr immediatelly.
Having a toggle entry in the OSD-menu, the user could also switch to
LiveTvMode in case that the vdr has been started for a recording event.
Please let me know, what you (especially Klaus) are think about this
suggestion.
Kind regards
geronimo
More information about the vdr
mailing list