[mythtv] SQL to determine if a specific encoder is recording

David Engel david at istwok.net
Thu May 10 22:29:09 UTC 2012


On Thu, May 10, 2012 at 03:54:57PM -0600, A McDermott wrote:
> Looking for SQL (or pointers to appropriate join/tables) which will
> allow me to determine if a particular encoder is busy.  I have found a
> way to get the info of the current or next recordings, but not how to
> cross-link with which particular encoder is or will be used for the
> recording.

That information isn't stored in the database, which you shouldn't be
accessing directly anyway.  What you need to do is access the master
backend using the Myth protocol.  The easiest way to do that is with
the Python bindings.  See http://www.mythtv.org/wiki/0.25_Python_Bindings
for more details.

> The endgame here is to once a day determine if my HDPVR is in use, or
> will be in use in the near future.  If the HDPVR encoder is not in
> use, I will reset it to try and avoid annoying HDPVR hangs.
> 
> Here is what I use to find the current recording program and the next
> scheduled recording.
> 
> Current recording (-2) or tuning (-10):
> 
> mysql> select starttime from oldrecorded where recstatus in (-2,-10);
> +---------------------+
> | starttime           |
> +---------------------+
> | 2012-05-10 15:00:00 |
> | 2012-05-10 15:00:00 |
> +---------------------+
> 2 rows in set (0.00 sec)
> 
> 
> Next scheduled recording:
> 
> mysql> select starttime from oldrecorded where recstatus in (-1) and
> starttime > NOW() order by starttime asc limit 2;
> +---------------------+
> | starttime           |
> +---------------------+
> | 2012-05-10 16:00:00 |
> | 2012-05-10 17:00:00 |
> +---------------------+
> 2 rows in set (0.00 sec)

Again, you shouldn't be accessing the database directly.  There's all
sorts of details and subtleties about the schema of which you probably
aren't aware.  Like above, the Python bindings can handle this quite
nicely for you.

David
-- 
David Engel
david at istwok.net


More information about the mythtv-dev mailing list