As part of my 'alternative stategy' for rule modification, I've noticed that a large number of my older rules had starttime=endtime=0. (I suspect they were created in 0.24 mythweb days as 'record all' rules).
This isn't causing them not to function, but when trying to amend those rules by echoing back the current rule with changes using the DVR API, 0.27.4 mythbackend says:
Code:
2015-07-04 19:12:02.423208 E [21857/28498] HttpServer71 servicehost.cpp:143 (Invoke) - MethodInfo::Invoke - An Exception Occurred: Invalid duration.
And rejects the command.
This is slightly more complicated as my power search rules and the 'Default' recording template have starttime=endtime!=0
I've now amended all the rules in the database that had a zero duration and zero end time to have a 2 second duration - and everything is fine again, but it begs the question:
Should pvr.mythv simply fail under these circumstances, or attempt a 'fix' of some sort?
My guess is 'apply a fix' and this is probably why the current code re-creates each rule from scratch using a 'known good' template, rather than simply modifying an existing rule :-(
For now I'll press on and add a 'check rule for consistency' function to fix problems like this before sending anything to the services API. More complication here we come...
PS: I also checked in the 0.27 source code. You can't just skip the start and end time parameters in the services API call :-(
EDIT: The existing code can't cope with this either - UpdateRecordingRule wasn't passing on start or end time at all for most timer types, so just uses the value provided by the original GetRecordScheduleList API call; Which the services API will then reject...