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