[mythtv-users] gaps updated for Python 3 and v31

Stephen Worthington stephen_agent at jsw.gen.nz
Tue May 5 17:17:09 UTC 2020


I have updated my "gaps" program that finds gaps between recordings in
the upcoming schedule.  The old 1.4 version was a Python 2 program
only compatible with MythTV up to v30.  The new version is a Python 2
and Python 3 compatible program that works with MythTV v31 as well as
older versions.

Please try it out and let me know if there are any problems.

The old 1.4 version is now available as gaps-1.4 from my web server:

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

To use it, put it in /usr/local/bin and rename it to "gaps":

sudo su
cd /usr/local/bin
wget http://www.jsw.gen.nz/mythtv/gaps-1.4
mv gaps-1.4 gaps
chown root:root gaps
chmod u=rwx,g=rx,o=rw gaps
exit

The new 1.5 version is available as:

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

To use it with Python 3 and MythTV v31, just download it and put it in
/usr/local/bin:

sudo su
cd /usr/local/bin
wget http://www.jsw.gen.nz/mythtv/gaps
chown root:root gaps
chmod u=rwx,g=rx,o=rw gaps
exit

To use it with Python 2 and MythTV v30 or below, the "python3" in the
first line of the file needs to be changed to "python2":

sudo su
cd /usr/local/bin
wget http://www.jsw.gen.nz/mythtv/gaps
chown root:root gaps
chmod u=rwx,g=rx,o=rw gaps
sed -i 's/python3/python2/' gaps
exit

Examples (sorry for the line wrapping, my email client has no way of
turning that off):

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

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

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)

root at mypvr:~# gaps
Gap:  start=Wed 2020-05-06 04:42:22+12:00  end=2020-05-06
07:10:00+12:00  duration=2:27:38
Gap:  start=Wed 2020-05-06 08:03:00+12:00  end=2020-05-06
09:30:00+12:00  duration=1:27:00
Gap:  start=Wed 2020-05-06 10:33:00+12:00  end=2020-05-06
10:50:00+12:00  duration=0:17:00
Gap:  start=Wed 2020-05-06 11:43:00+12:00  end=2020-05-06
13:45:00+12:00  duration=2:02:00
Gap:  start=Wed 2020-05-06 14:58:00+12:00  end=2020-05-06
16:10:00+12:00  duration=1:12:00
Gap:  start=Wed 2020-05-06 17:03:00+12:00  end=2020-05-06
17:57:00+12:00  duration=0:54:00
Gap:  start=Thu 2020-05-07 00:33:00+12:00  end=2020-05-07
07:35:00+12:00  duration=7:02:00
Gap:  start=Thu 2020-05-07 08:03:00+12:00  end=2020-05-07
09:30:00+12:00  duration=1:27:00
Gap:  start=Thu 2020-05-07 11:13:00+12:00  end=2020-05-07
16:30:00+12:00  duration=5:17:00
Gap:  start=Thu 2020-05-07 17:33:00+12:00  end=2020-05-07
17:57:00+12:00  duration=0:24:00
Gap:  start=Thu 2020-05-07 23:33:00+12:00  end=2020-05-08
00:29:00+12:00  duration=0:56:00
Gap:  start=Fri 2020-05-08 01:03:00+12:00  end=2020-05-08
07:35:00+12:00  duration=6:32:00
Gap:  start=Fri 2020-05-08 08:03:00+12:00  end=2020-05-08
09:30:00+12:00  duration=1:27:00
Gap:  start=Fri 2020-05-08 10:33:00+12:00  end=2020-05-08
15:05:00+12:00  duration=4:32:00
Gap:  start=Fri 2020-05-08 15:58:00+12:00  end=2020-05-08
17:30:00+12:00  duration=1:32:00
Gap:  start=Fri 2020-05-08 23:08:00+12:00  end=2020-05-08
23:45:00+12:00  duration=0:37:00
Gap:  start=Sat 2020-05-09 00:38:00+12:00  end=2020-05-09
09:30:00+12:00  duration=8:52:00
Gap:  start=Sat 2020-05-09 11:33:00+12:00  end=2020-05-09
12:20:00+12:00  duration=0:47:00
Gap:  start=Sat 2020-05-09 13:18:00+12:00  end=2020-05-09
13:40:00+12:00  duration=0:22:00
Gap:  start=Sat 2020-05-09 15:33:00+12:00  end=2020-05-09
16:30:00+12:00  duration=0:57:00
Gap:  start=Sat 2020-05-09 21:35:00+12:00  end=2020-05-09
21:40:00+12:00  duration=0:05:00
Gap:  start=Sat 2020-05-09 22:53:00+12:00  end=2020-05-09
23:30:00+12:00  duration=0:37:00
Gap:  start=Sun 2020-05-10 00:33:00+12:00  end=2020-05-10
13:00:00+12:00  duration=12:27:00
Gap:  start=Sun 2020-05-10 14:08:00+12:00  end=2020-05-10
15:00:00+12:00  duration=0:52:00
Gap:  start=Sun 2020-05-10 16:08:00+12:00  end=2020-05-10
18:00:00+12:00  duration=1:52:00
Gap:  start=Sun 2020-05-10 19:03:00+12:00  end=2020-05-10
19:30:00+12:00  duration=0:27:00
Gap:  start=Sun 2020-05-10 21:33:00+12:00  end=2020-05-10
22:04:00+12:00  duration=0:31:00
Gap:  start=Sun 2020-05-10 23:13:00+12:00  end=2020-05-11
00:10:00+12:00  duration=0:57:00
Gap:  start=Mon 2020-05-11 01:43:00+12:00  end=2020-05-11
07:10:00+12:00  duration=5:27:00
Gap:  start=Mon 2020-05-11 08:03:00+12:00  end=2020-05-11
14:30:00+12:00  duration=6:27:00
Gap:  start=Mon 2020-05-11 16:03:00+12:00  end=2020-05-11
17:57:00+12:00  duration=1:54:00
Gap:  start=Mon 2020-05-11 23:33:00+12:00  end=2020-05-12
01:50:00+12:00  duration=2:17:00
Gap:  start=Tue 2020-05-12 02:43:00+12:00  end=2020-05-12
07:35:00+12:00  duration=4:52:00
Gap:  start=Tue 2020-05-12 08:03:00+12:00  end=2020-05-12
09:30:00+12:00  duration=1:27:00
Gap:  start=Tue 2020-05-12 10:33:00+12:00  end=2020-05-12
11:20:00+12:00  duration=0:47:00
Gap:  start=Tue 2020-05-12 11:33:00+12:00  end=2020-05-12
12:00:00+12:00  duration=0:27:00
Gap:  start=Tue 2020-05-12 13:03:00+12:00  end=2020-05-12
13:45:00+12:00  duration=0:42:00
Gap:  start=Tue 2020-05-12 14:58:00+12:00  end=2020-05-12
17:57:00+12:00  duration=2:59:00
Gap:  start=Wed 2020-05-13 00:30:00+12:00  end=2020-05-13
00:50:00+12:00  duration=0:20:00
Gap:  start=Wed 2020-05-13 01:23:00+12:00  end=2020-05-13
07:30:00+12:00  duration=6:07:00
Gap:  start=Wed 2020-05-13 08:30:00+12:00  end=2020-05-13
09:30:00+12:00  duration=1:00:00
End of scheduled recordings                end=2020-05-13
10:33:00+12:00

root at mypvr:~# gaps 2 30
Searching for a minimum duration of 2:30:00
Gap:  start=Thu 2020-05-07 00:33:00+12:00  end=2020-05-07
07:35:00+12:00  duration=7:02:00
Gap:  start=Thu 2020-05-07 11:13:00+12:00  end=2020-05-07
16:30:00+12:00  duration=5:17:00
Gap:  start=Fri 2020-05-08 01:03:00+12:00  end=2020-05-08
07:35:00+12:00  duration=6:32:00
Gap:  start=Fri 2020-05-08 10:33:00+12:00  end=2020-05-08
15:05:00+12:00  duration=4:32:00
Gap:  start=Sat 2020-05-09 00:38:00+12:00  end=2020-05-09
09:30:00+12:00  duration=8:52:00
Gap:  start=Sun 2020-05-10 00:33:00+12:00  end=2020-05-10
13:00:00+12:00  duration=12:27:00
Gap:  start=Mon 2020-05-11 01:43:00+12:00  end=2020-05-11
07:10:00+12:00  duration=5:27:00
Gap:  start=Mon 2020-05-11 08:03:00+12:00  end=2020-05-11
14:30:00+12:00  duration=6:27:00
Gap:  start=Tue 2020-05-12 02:43:00+12:00  end=2020-05-12
07:35:00+12:00  duration=4:52:00
Gap:  start=Tue 2020-05-12 14:58:00+12:00  end=2020-05-12
17:57:00+12:00  duration=2:59:00
Gap:  start=Wed 2020-05-13 01:23:00+12:00  end=2020-05-13
07:30:00+12:00  duration=6:07:00
End of scheduled recordings                end=2020-05-13
10:33:00+12:00

root at mypvr:~# gaps 2 30 | head -n 2
Searching for a minimum duration of 2:30:00
Gap:  start=Thu 2020-05-07 00:33:00+12:00  end=2020-05-07
07:35:00+12:00  duration=7:02:00


More information about the mythtv-users mailing list