[mythtv-users] Events at the beginning of a recording

Ian Cameron mkbloke at gmail.com
Tue Jan 24 19:46:48 UTC 2023


On Tue, 24 Jan 2023 at 18:02, Jan Ceuleers <jan.ceuleers at gmail.com> wrote:

> I was wondering whether there is any more documentation about the
> recording pending and recording started events than is available on the
> wiki (which isn't very much).
>

I'm not sure there is, so you'll have to rely on the wisdom of folks on
this list, I think.

I have read that the one envisaged uses of the recording pending event
> is for it to trigger e.g. a set-top box being woken up, but for that to
> be possible it would have to be triggered before the recording actually
> begins, and the beginning of the recording should also wait until the
> recording pending script returns.
>

As far as I know, the recording pending events are fired asynchronously.
There is no waiting for them to finish, rather, they are expected to have
successfully done their job before MythTV starts recording (including the
pre-roll).  On my system I consistently see recording pending events
triggered at 94, 60 and 29 seconds before the pre-roll is due to start.

If you're only powering on a set-top box and changing its channel, then I
would have thought 29s would be enough time to successfully complete that.
You can pass %SECS% to the script in mythtv-setup for the recording_pending
system event script configuration.

If you're passing %SECS% as the first parameter to your script, then in the
script you can do something like:

ME="$(/usr/bin/basename ${0})"
TIME_SECS=${1}
if [ ${TIME_SECS} -gt 35 ]
then
  echo "${ME}: time to programme start ${TIME_SECS}; exiting" \
    >> /some/path/recording_pending.log
  exit
fi
# put channel change stuff here

If you needed more time, then you could change '-gt 35' to '-gt 65',
above.  If you do that though the pending script is still called again and
if you don't want it to execute again then in that case, you'd need to
create a semaphore file during the ~60s event, that is then checked for by
the ~30s event and then deleted within that event before exiting having
done nothing more.

On my backend I'm seeing the opposite: the recording started event
> occurs before the recording pending event, and it obviously doesn't wait
> for one event to be handled before the next-one begins.
>

I haven't tried using recording_started, but it seems like it should come
after pending to me, so that's a bit odd.

Cheers, Ian
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mythtv.org/pipermail/mythtv-users/attachments/20230124/e5c0e2d4/attachment.htm>


More information about the mythtv-users mailing list