[mythtv-users] ensuring mythbackend will be idle for db optimize

Jerome Yuzyk jerome at supernet.ab.ca
Tue Sep 22 16:00:36 UTC 2015


On Tuesday, September 22, 2015 07:52:35 PM Stephen Worthington wrote:
> On Mon, 21 Sep 2015 12:48:42 -0600, you wrote:
>
> ...
> avoid times when recording is happening.  I already have a crude way
> of doing this in my balance_storage.sh script, by parsing the output
> of the mythtv-status command, so that balance_storage.sh will stop if
> the next recording is within 5 minutes (or if there is a recording in
> progress).  Feel free to borrow any code you like from it:
> 
>   http://www.jsw.gen.nz/mythtv/balance_storage.sh
> 
> So I could just do the same, and have the optimise script wait 15
> minutes whenever it sees a recording running or scheduled in less than
> 15 minutes.  That should work, but there is likely now a much better
> way of getting the time of the next recording directly from
> mythbackend using the Services API or Python bindings.  When I find
> the time, I intend to start learning about the Services API, which
> seems to be where the new work is going now.

There's a super-easy example at https://www.mythtv.org/wiki/Upcoming_Parse.pl that I have modified to just pick the first upcoming recording and compare its timestamp to now. The API requires XML parsing but there are plenty of ways to do that.



More information about the mythtv-users mailing list