[mythtv-users] Stop / Start Athcool just Befor / After a Recording

Erik Karlin e_karlin at yahoo.com
Wed Nov 23 12:33:22 EST 2005


On Wed, Nov 23, 2005 at 09:06:40AM +0800, Bob wrote:
> chris at cpr.homelinux.net wrote:
> >On Tue, Nov 22, 2005 at 04:08:29PM +0800, Bob wrote:
> >
> >>Is there a way to run a script just before a recording starts and 
> >>another after it ends, ideally this would be specific to a capture 
> >>source as my next card (PVR 500) may not have this issue?
> >
> >I don't know how to trigger scripts when a recording starts, and 
> >managing sequential recordings would be a problem because you could end 
> >up with a race condition. It would be easier to use a cron job that 
> >parses http://localhost:6544/xml once per minute and looks for the 
> >appropriate tuner status:
> >
> >$ lynx -dump http://localhost:6544/xml | head -n 5
> ><!DOCTYPE Status>
> ><Status version="0.18.1.20050510-1" protoVer="15" time="6:15 AM" 
> >date="11/22/2005" >
> ><Encoders count="1" >
> ><Encoder local="1" connected="1" id="1" state="0" lowOnFreeSpace="0" 
> >hostname="linuxbox" />
> ></Encoders>
> >
> >You would want to look for the appropriate "Encoder" record and toggle
> >the external program based on the state field.
> 
> That could work, but it's a bit expensive and inelegant.
> 
> If it were possible to run a shell script when a recording starts and 
> ends, the end script could use your method to check if there is an 
> imminent recording and not restart Athcool if there is, that would fix 
> the potential race condition you highlighted.
> 
you could just hijack the channel change "script" functionality and
create a user job when the recording completes. The problem of
back-to-back recordings is still possible. maybe some clever file
locking scheme between a channel change (start) and user job (end) could
do the trick.


More information about the mythtv-users mailing list