[mythtv-users] Seeking PVR-150 / channel change script / backend contention advice

Joe Hickey jfwd at phlobus.net
Thu Jan 13 17:52:25 UTC 2011

Hi all,

I'm hoping to solve this problem in a better way.  Here's some
background info- my third tuner is a PVR-150 connected to a cable STB
so I can record all those channels that aren't sent clear QAM.  It
works, except the cable box is not particularly stable; it turns off,
reboots itself or otherwise misbehaves regularly, particularly during
the night, causing missed recordings.

Here's what I did as a workaround: as part of my channel change script
I dump a couple seconds of video to a file in /tmp (by reading
/dev/video0 directly), and then use a couple tools to dump a few
frames to JPG files and then convert these to ascii art (I forget the
tool names).  Basically it's a blank screen detection -- if I get
blanks, I blast a "POWER" button before changing the channel.

This improved the situation greatly for recordings.  However, I
suspect there is some contention now as both the backend and my script
are trying to open /dev/video0.  LiveTV on this turner doesn't seem to
work at all.  I suppose a better way would be if I looked at the
actual file that mythbackend is recording to, but there is no easy way
for a channel change script to know this as far as I can tell.

I found one script that does a few mysql queries to figure this out,
querying the channels table to get the chanid and then the recordings
table to find the latest entry on that chanid, but by doing something
like that you've now tied your channel change script to the myth
database schema, and created dependencies on the recordings table
being updated before the script is called, etc.  It seems like it's
prone to breakage as well.

So - my question:
a) Is there any reliable way that a channel change script can obtain
the filename that mythbackend is starting it's recording to?
b) Is there a way to determine if the cable box is on that doesn't
require access to the video stream, like querying some other statistic
in the ivtv driver?

Thanks in advance!

More information about the mythtv-users mailing list