media-sucker/scripts/encoder.sh

32 lines
777 B
Bash
Executable File

#! /bin/sh
. $(dirname $0)/common.sh
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)
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
# vi: ts=2 sw=2 et ai