[vdr] suggestion for shutdown-handling

Udo Richter udo_richter at gmx.de
Thu Mar 2 15:59:08 CET 2006


> 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. 

I'm not sure how this actually solves the background activity issue. 
There already is a distinction between interactive mode and automatic 
mode, based on LastActivity. And giving plugins full access to it would 
result in conflicts if several plugins start messing with it.


Some general thoughts on shutdown management:

There are three different groups involved in shutdown management: First, 
the interactive user. Second, plugins that do background tasks. And 
third, external scripts that do other work.

Interactive use is handled quite well by the LastActivity concept. 
Plugin activity is currently hard to realize, though not impossible. 
(variant 1: send fake key presses, variant 2: rely on external scripts 
that cancel shutdown.) External script activity is possible, but could 
be improved.

For external scripts, I would suggest a method similar to LastActivity: 
Allow scripts to set an inactivity timer via SVDRP, "I'm busy right now, 
ask again in x minutes", with the possibility to announce "I'm done now, 
go ahead if there's no user activity". The important point is that this 
shouldn't mess with LastActivity, but with some other timeout variable, 
so LastActivity really represents user activity.
This could also be accompanied by a variant of the -s shutdown script, 
that actually queries for activity before asking the user.
As typical for external scripts, if there's more than one script out 
there, they have to somehow work together as one.

For internal use, a callback method is probably the best way to handle 
it. A LastActivity-like timeout would require a separate timeout for 
each background activity, and a callback method isn't that much overhead.
But instead of extending the plugin interface, I would suggest some 
cShutdownControl class independent of the plugin interface, with 
cShutdownControl::Active() callback. This could be as simple as 
inheriting this class into a cThread, and the default callback would 
cancel all shutdowns. (unless forced by user.)
This could even be used by recordings, cutter and SVDRP connection for 
further cleanup.

Of course thats just thoughts how this could be handled, and I don't 
expect anything before 1.5.

Cheers,

Udo



More information about the vdr mailing list