#! /bin/sh . $(dirname $0)/common.sh while sleep 2; do status encoder idle 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") status encoder encoding (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