[mythtv-users] Automatic channel scans

Stephen Worthington stephen_agent at jsw.gen.nz
Thu Aug 10 14:20:35 UTC 2017


On Thu, 10 Aug 2017 13:13:13 +0100, you wrote:

>That wiki page says "The backend must not be using the card to be 
>scanned when it is scanned. This generally means that the backend should 
>not be running." If the intention is to run this periodically, then it 
>would be best if mythtv-setup had the ability to ask the backend to 
>vacate the card while still being available for serving up existing 
>recordings. In other words, mythtv-setup should request control of the 
>card and, if the backend is recording on it (or, say, will record in the 
>next 30 minutes) then it rejects the request, otherwise it quietly 
>releases the card and mytv-setup runs it's scan. What I want to avoid is 
>people creating a cronjob like:
>
>*/30 * * * * service mythtv-backend stop ; mythtv --scan-save-only ; 
>service mythtv-backend start
>
>and wondering why their recordings are interrupted, why the family can't 
>watch a film without "The backend has stopped" popping up every 30 
>minutes etc.

If you want to know when mythbackend is not busy, you could try using
my gaps program:

http://www.jsw.gen.nz/mythtv/gaps

Gaps is a Python 2 program that queries mythbackend and works out when
it is due to be recording something, so it can tell you when all the
gaps between recordings are.

root at mypvr:~# gaps --help
usage: gaps [-h] [-V] [-n HOST] [-p PORT] [hours] [minutes]

Find gaps in the MythTV recording schedule (Version: 1.3)

positional arguments:
  hours        Minimum gap duration to search for, in hours (floating
point
               allowed)
  minutes      Minimum gap duration to search for, in minutes
(floating point
               allowed)

optional arguments:
  -h, --help   show this help message and exit
  -V, --version
               display the version number and exit
  -n HOST, --host HOST
               MythTV backend hostname (default: mypvr)
  -p PORT, --port PORT
               MythTV backend API port number (default: 6544)

It does not take into account the soft pre-roll and soft post-roll
settings you may be using.  I have them set to 60 seconds, so I need
to leave an extra minute after when gaps says the start of a gap is,
and the gap ends a minute before it says it does.  The host and port
values are queried from the database if possible, so it will normally
find them automatically if run on the backend PC.


More information about the mythtv-users mailing list