34 lines
657 B
Bash
Executable File
34 lines
657 B
Bash
Executable File
#! /bin/sh
|
|
|
|
. $(dirname $0)/common.sh
|
|
|
|
run_in () {
|
|
(
|
|
cd $1; shift
|
|
setenv status "encoding"
|
|
"$@"
|
|
)
|
|
}
|
|
|
|
while sleep 2; do
|
|
echo "idle" > $OUTDIR/status.encoder
|
|
for mtype in audio video; do
|
|
ls $mtype | while read d; do
|
|
encode=/scripts/$mtype.encode.sh
|
|
workdir=$mtype/$d
|
|
status=$(cd $workdir && getenv status)
|
|
[ "$status" = "read finished" ] || continue
|
|
|
|
echo "encoding" > $OUTDIR/status.encoder
|
|
if ! run_in $workdir $encode; then
|
|
log "$encode failed"
|
|
(cd $workdir && setenv status "encode failed")
|
|
else
|
|
rm -rf $workdir
|
|
fi
|
|
done
|
|
done
|
|
done
|
|
|
|
# vi: ts=2 sw=2 et ai
|