<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 12pt;
font-family:Calibri
}
--></style></head>
<body class='hmmessage'><div dir='ltr'><br> <BR><div>> From: jerome@supernet.ab.ca<br>> To: stephen@jsw.gen.nz; mythtv-users@mythtv.org<br>> Date: Tue, 22 Sep 2015 10:00:36 -0600<br>> Subject: Re: [mythtv-users] ensuring mythbackend will be idle for db optimize<br>> <br>> On Tuesday, September 22, 2015 07:52:35 PM Stephen Worthington wrote:<br>> > On Mon, 21 Sep 2015 12:48:42 -0600, you wrote:<br>> ><br>> > ...<br>> > avoid times when recording is happening. I already have a crude way<br>> > of doing this in my balance_storage.sh script, by parsing the output<br>> > of the mythtv-status command, so that balance_storage.sh will stop if<br>> > the next recording is within 5 minutes (or if there is a recording in<br>> > progress). Feel free to borrow any code you like from it:<br>> > <br>> > http://www.jsw.gen.nz/mythtv/balance_storage.sh<br>> > <br>> > So I could just do the same, and have the optimise script wait 15<br>> > minutes whenever it sees a recording running or scheduled in less than<br>> > 15 minutes. That should work, but there is likely now a much better<br>> > way of getting the time of the next recording directly from<br>> > mythbackend using the Services API or Python bindings. When I find<br>> > the time, I intend to start learning about the Services API, which<br>> > seems to be where the new work is going now.<br>> <br>> 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.<br>> <br>> <div>Or, yet another way. Since you are using mythwelcome and presumably ACPI for wakeup, you will have a routine which sets the wakup time - suggested name in the wiki is /usr/bin/setwakeup.sh. Planting your code there will also work. That's where I plant database backups, optimizes and copying of recordings and everything waits nicely until they are finished. See autobackup.sh in the wiki for the approach.</div><div> </div><div>Phil Brady<br></div></div> </div></body>
</html>