Robin Mitra wrote:
I was thinking about systemd.logind dbus api. E.g. here: https://www.freedesktop.org/wiki/Software/systemd/inhibit/
OK. This seems like an easy addition - add locking when tvh is busy with a recording and/or streaming.
I'm just not sure if the wake timers (systemd.timer with wake option) is actually programmatically accessible(modifiable). If so, then a service, that is signaled to prepare for sleep, could set this timer to the next time it needs to do something (next recording or scan or whatever).
I've not found a way to control the system wake-up time through systemd from an application. Appearently, this can be controlled only through the timer unit. You may discuss this with systemd developers.
Also note that tvh can emit signals through dbus with the 'next' time of a DVR event, so the power management may be handled outside tvh.
That's how WMC works anyway. And yes,it actually works even past it's death, for now what, 11 years?
Btw, for this to work, tvh should also let go off of resources when idle (i.e. tuners, so that they can do there own power management, and need not be taken care of in the tvh suspend task), and obviously enumerate them again upon resume.
The linuxdvb devices are closed when they're idle - it's configurable by user - 'Power save' option per tuner settings.
There are certain subtle things to consider, i.e.
- allow sleep with open but idle connections (selectable in windows)
- allow 'away mode', e.g. service itself is busy, but doesn't need a GUI (which is almost always the case for things like tvh)
I haven't found the time to play around with this yet. But at least it seems to be what one needs for this.
TVH GUI is served through the HTTP server - so, tvh itself is only service. Also, consider, that if we put the system in the sleep state, we cannot handle the 'live' streaming requests.