Slightly smarter encode failure reporting
This commit is contained in:
parent
16b5412875
commit
5ee0655e6e
|
@ -4,6 +4,9 @@
|
|||
: ${OUTDIR:=/incoming}
|
||||
export OUTDIR
|
||||
|
||||
# This gets set to the directory containing what's currently running
|
||||
: ${SCRIPTS:=$(dirname $0)}
|
||||
|
||||
log () {
|
||||
printf "\033[36m=== [%s] \033[0m %s\n" "$0" "$*"
|
||||
}
|
||||
|
|
|
@ -2,30 +2,28 @@
|
|||
|
||||
. $(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
|
||||
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
|
||||
case "$status" in
|
||||
"encoding")
|
||||
(cd $workdir && setenv status "encode interrupted")
|
||||
;;
|
||||
"read finished")
|
||||
echo "encoding" > $OUTDIR/status.encoder
|
||||
(cd $workdir && setenv status "encoding")
|
||||
if ! (cd $workdir && $encode); then
|
||||
log "$encode failed"
|
||||
(cd $workdir && setenv status "encode failed")
|
||||
else
|
||||
rm -rf $workdir
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
done
|
||||
done
|
||||
done
|
||||
|
|
Loading…
Reference in New Issue