[mythtv-users] What can be controlled through a system event perl script?

Michael T. Dean mtdean at thirdcontact.com
Tue Dec 13 05:46:10 UTC 2011


On 12/12/2011 11:22 PM, Raymond Wagner wrote:
> On 12/12/2011 22:19, Daniel Born wrote:
>> Firstly, I'm using Mythbuntu 10.04 with Mythtv 0.23.1 (latest 0.23 
>> release)
>>
>> I'm using find-zero-byte.pl with Gavin's "HDPVR killer device". This 
>> perl script is called from the RecordingStarted system event.
>>
>> Today my hdpvr locked up and the find-zero-byte.pl script worked in 
>> the sense that it reset the pdpvr by power cycling it. The script 
>> also returned a '1' to the caller BUT even though the hdpvr 
>> recovered, myth continued to "record" to a zero byte file for the 
>> rest of that recording schedule.
>
> The System Event utility in MythTV just exists trigger an external 
> command on certain events.  It doesn't know or care what the script 
> does, nor does it do anything based off the return code.  The script 
> needs to handle everything on its own.
>
> If you only have the one active recording, restarting the backend in 
> question would have the desired effect.  I'm not certain what would be 
> required to do such internally.  Perhaps a STOP_RECORDING, a 
> DELETE_RECORDING with a forget, and a rerun of the scheduler on that 
> recording rule.  Someone who knows the scheduler better would be able 
> to answer that properly, although the best solution would be to add a 
> RESTART_RECORDING command to the protocol and/or Services API.

A FORGET_RECORDING will result in the scheduler's re-running, so whether 
you do a:

  * STOP_RECORDING + FORGET_RECORDING
  * DELETE_RECORDING + FORGET_RECORDING
  * DELETE_RECORDING <chanid> <starttime> FORGET

the scheduler will run as a result.  Note, also, that DELETE_RECORDING 
(with or without FORGET arg) will also stop the recording for you.

The behavior of the scheduler is such that the recording will be 
restarted iff there is no other showing of the program in the currently 
available listings.  If there is another showing, the scheduler will 
choose to record the later showing in full rather than record only part 
of the show with the currently-airing showing.

Therefore, in theory, you can do any of the 3 options above--but, in 
this case (where you have a 0-byte file because of recorder failure), 
the last is probably most appropriate (because it deletes the metadata 
for the failed recording with a 0-byte file) and it's a single command, 
rather than the 2-step approach in the 2nd option.

And, I know that the Python bindings make sending a DELETE_RECORDING ... 
FORGET very easy, but I'll leave you in Raymond's more capable hands for 
figuring out exactly how with a link to the docs: 
http://www.mythtv.org/wiki/0.24_Python_Bindings (or 
http://www.mythtv.org/wiki/Category:Python ).

Mike


More information about the mythtv-users mailing list