[mythtv-users] Finding gaps in the MythTV recording schedule to do maintenance in
Mark Perkins
perkins1724 at hotmail.com
Sun Apr 23 00:28:40 UTC 2017
On 20/04/17 17:07, Stephen Worthington wrote:
> On Wed, 19 Apr 2017 22:34:48 +1200, you wrote:
>
>> I have a busy MythTV box, so when I need a few hours to do some
>> maintenance on it, such as changing tuner cards or rearranging the
>> drives, it can be a problem to work out when enough time will be
>> available. So I wrote myself a Python script called "gaps" that uses
>> the new API to get the recording schedule and find when there are gaps
>> in it. It takes one command line parameter which is the minimum
>> number of hours of gap needed. If there are no parameters given, it
>> will list all the gaps, no matter how small. The script is rather
>> rough and ready, but it works for me.
>>
>> To use it, you need to also have the Utilties.py Python module
>> installed. You can download that from the Wiki Python API Examples
>> page. I just put a copy of the file in my /usr/local/bin directory.
>> Make sure you save the file as a UTF-8 encoded file.
>>
>> Wiki Python API Examples page:
>> https://www.mythtv.org/wiki/Python_API_Examples
>>
>> gaps script:
>> http://www.jsw.gen.nz/mythtv/gaps
>>
>> Please let me know if you find any problems with it.
> I have just put a slightly updated version of the "gaps" script on my
> web server. It seems that Python is quite permissive in what it will
> accept for a time duration (datetime.timedelta), so I am now allowing
> a floating point number on the command line for the number of hours
> minimum gap size to search for.
> _______________________________________________
>
Thanks Stephen, this is quite good!
I had one issue getting this to work, I run 0.27, 0.28 and master
simultaneously on the one server so I have moved the services api ports
in mythtv-setup so they don't conflict. Utilities.py is hardcoded to use
port 6544 (which is the default). Once I changed that to the backend
services port I wanted it worked perfectly Unfortunately I don't know
python but if I get some spare time I might try and see what it would
take to get Utilities.py to pull the port from the database using a
found config.xml. Maybe it could pull the host as well, although I think
your gaps.py script is coded to localhost only. I'm just thinking out loud.
Thankyou again for putting this together and sharing!
More information about the mythtv-users
mailing list