media-sucker/scripts/encoder.sh

30 lines
465 B
Bash
Raw Normal View History

2022-01-06 12:31:30 -07:00
#! /bin/sh
. /scripts/common.sh
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
log "Encoding $workdir"
if ! run_in $workdir $encode; then
log "$encode failed"
else
rm -rf $workdir
fi
done
done
done
# vi: ts=2 sw=2 et ai