For users wishing to put their TVH server into a low power state (sleep, hibernate) when not in use, it could be handy to know when TVH is next scheduled to perform a task. An external application could put the server hardware to sleep and wake it in time for TVH to perform its next scheduled task.
Although there could be more, I have currently identified 4 categories where TVH performs scheduled tasks:
Recording DVR Events
Grabbing OTA EPG
Grabbing 'Internal' EPG
Scheduling Muxes
Although this information can be obtained by processing various existing API calls, I'm thinking about creating a new API call to obtain this information from a single place. Options could be 'api/config/cron/next' or 'api/status/cron/next'. I prefer the 'status' call because if reflects that the data returned is dynamic like the rest of the 'status' calls.
The call would return the timing of the overall next task to be performed as well as an array of all of the next task for the individual areas detailed above. The single time would be handy for simple system sleep operations, however, an external application may wish to ignore certain non-essential categories and only wake for specific categories.
The output would look something like this:
{
"next": 123456789,
"categories": {
"dvr": 123456789,
"ota_grabber": 234567890,
"int_grabber": 234567891,
"mux_scheduler": 34567890123
}
}
The numbers represent a Unix Epoch time as currently returned by the DVR and EPG API calls. These would be raw exact numbers, hardware start-up times would have to be accounted for by the external application when determining the actual wake time.
Categories without a time would be set to 0 (zero).
Thoughts and comments welcome.