From 935cb540e45de06a2676e5d04a925a20c5075b74 Mon Sep 17 00:00:00 2001 From: rey jean-Francois Date: Mon, 26 Aug 2013 15:58:21 +0200 Subject: [PATCH] check if avconv is installed --- main_tools/FirstPass.sh | 36 +++++++++++++++++++++--------------- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/main_tools/FirstPass.sh b/main_tools/FirstPass.sh index 3d55762..d3c20b3 100755 --- a/main_tools/FirstPass.sh +++ b/main_tools/FirstPass.sh @@ -188,22 +188,28 @@ print_info "[${BASENAME}] Save config in $OUTPUT_DIR_BASENAME/FirstPass.cfg" 1 #-------------------------# # Check Audio File Format # #-------------------------# -error=0 -temp=$(avconv -i $WAV_FILE 2>&1 | grep "16000 Hz") -if [ -z "$temp" ]; then error=1; fi -temp=$(avconv -i $WAV_FILE 2>&1 | grep "1 channels") -if [ -z "$temp" ]; then error=1; fi -temp=$(avconv -i $WAV_FILE 2>&1 | grep "s16") -if [ -z "$temp" ]; then error=1; fi - -if [ $error -eq 1 ] +test=$(whereis avconv) +if [ "$test" == "avconv:" ] then - print_message $WARNING 2 "[${BASENAME}] $WAV_FILE is not a wav file at 16000 Hz, 1 channel, 16bits\nhave to convert" - print_message $INFO 3 "[${BASENAME}] avconv -i $WAV_FILE -threads 4 -vn -f wav -ac 1 -ar 16000 -ab 256000 $OUTPUT_DIR_BASENAME/$BASENAME.wav" - avconv -i $WAV_FILE -threads 4 -vn -f wav -ac 1 -ar 16000 -ab 256000 $OUTPUT_DIR_BASENAME/$BASENAME.wav - WAV_FILE=$OUTPUT_DIR_BASENAME/$BASENAME.wav - FILENAME=$BASENAME.wav - print_message $INFO 1 "[${BASENAME}] new wav file : $WAV_FILE" + print_message $ERROR 1 "[${BASENAME}] avconv is not installed" +else + error=0 + temp=$(avconv -i $WAV_FILE 2>&1 | grep "16000 Hz") + if [ -z "$temp" ]; then error=1; fi + temp=$(avconv -i $WAV_FILE 2>&1 | grep "1 channels") + if [ -z "$temp" ]; then error=1; fi + temp=$(avconv -i $WAV_FILE 2>&1 | grep "s16") + if [ -z "$temp" ]; then error=1; fi + + if [ $error -eq 1 ] + then + print_message $WARNING 2 "[${BASENAME}] $WAV_FILE is not a wav file at 16000 Hz, 1 channel, 16bits\nhave to convert" + print_message $INFO 3 "[${BASENAME}] avconv -i $WAV_FILE -threads 4 -vn -f wav -ac 1 -ar 16000 -ab 256000 $OUTPUT_DIR_BASENAME/$BASENAME.wav" + avconv -i $WAV_FILE -threads 4 -vn -f wav -ac 1 -ar 16000 -ab 256000 $OUTPUT_DIR_BASENAME/$BASENAME.wav + WAV_FILE=$OUTPUT_DIR_BASENAME/$BASENAME.wav + FILENAME=$BASENAME.wav + print_message $INFO 1 "[${BASENAME}] new wav file : $WAV_FILE" + fi fi #---------------# -- 1.8.2.3