media-sucker/scripts/encoder.sh

32 lines
555 B
Bash
Raw Normal View History

2022-01-06 12:31:30 -07:00
#! /bin/sh
2022-01-09 16:26:12 -07:00
. $(dirname $0)/common.sh
2022-01-06 12:31:30 -07:00
run_in () {
(
cd $1; shift
"$@"
)
}
while sleep 2; do
for mtype in audio video; do
ls $mtype | while read d; do
encode=/scripts/$mtype.encode.sh
workdir=$mtype/$d
[ -f $workdir/read.finished ] || continue
2022-01-09 16:26:12 -07:00
echo "$workdir" > $OUTDIR/$mtype.status
setenv status "encoding"
2022-01-06 12:31:30 -07:00
if ! run_in $workdir $encode; then
log "$encode failed"
else
rm -rf $workdir
fi
done
done
2022-01-09 16:26:12 -07:00
echo "idle" > $OUTDIR/$mtype.status
2022-01-06 12:31:30 -07:00
done
# vi: ts=2 sw=2 et ai