[mythtv-users] stagger start times for simultaneous recordings?
Ronald Frazier
ron at ronfrazier.net
Fri Oct 21 18:43:01 UTC 2011
> Were it me, I'd try and implement some crude form of "locking"
> inside the channel-change script(s), so that one instance would
> loop and sleep/wait until the other has finished its thing.
A while back I had a channel change script with some very basic
locking code in it. It doesn't handle race conditions, but should work
pretty good (might fail once in a million times or something). Here's
a copy:
#!/bin/sh
LOCKFILE=/tmp/lirclock
TRANSMITTER_NUMBER=1
REMOTE_NAME=wow_dta_remote
SETUPDELAY=.1
DELAY=.2
cmd="$1"
while [ -f $LOCKFILE ]
do
#echo "Waiting for lock..."
sleep .1
done
touch $LOCKFILE
irsend SET_TRANSMITTERS $TRANSMITTER_NUMBER
sleep $SETUPDELAY
case $cmd in
[0-9]*)
for digit in $(echo $1 | sed -e 's/./& /g'); do
irsend SEND_ONCE $REMOTE_NAME $digit
sleep $DELAY
done
irsend SEND_ONCE $REMOTE_NAME ENTER
;;
*)
irsend SEND_ONCE $REMOTE_NAME $cmd
;;
esac
rm $LOCKFILE
--
Ron Frazier
More information about the mythtv-users
mailing list