Skip to content

Instantly share code, notes, and snippets.

@paselin
Last active November 7, 2015 17:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save paselin/324c58051227f4df33cc to your computer and use it in GitHub Desktop.
Save paselin/324c58051227f4df33cc to your computer and use it in GitHub Desktop.
#!/bin/bash
ENCODE_QUE=()
FLG=0
cd /home/pi/chinachu/
PS=`ps ax | grep ./encode.sh | grep -v "grep ./encode.sh"`
echo ${PS}
if test -z "${PS}" ; then
for REC in `ls -F ./video/ | grep -v / | sed -e "s/\.m2ts//"`
do
FLG=0
echo " rec_file:${REC}"
for ENC in `ls -F ./video/encoded/ | grep -v / | sed -e "s/\.mp4//"`
do
#echo "enc_file:$ENC"
if test ${REC} = ${ENC} ; then
echo "file encode already."
FLG=1
break
fi
done
if test ${FLG} -eq 0 ; then
echo "recode add!!!!!!"
REC_FILE="${REC}.m2ts"
ENCODE_QUE=("${ENCODE_QUE[@]}" "${REC_FILE}")
fi
done
for TITLE in ${ENCODE_QUE[@]}
do
./encode.sh "./video/${TITLE}"
done
else
echo "encode now!!"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment