2020-03-15 22:40:38 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
set -o pipefail
|
|
|
|
|
|
|
|
errored=0
|
|
|
|
|
|
|
|
files=$(ls | wc -l)
|
|
|
|
|
|
|
|
if [ $files -eq 1 ]; then
|
|
|
|
mv $(ls)/* .
|
|
|
|
fi
|
|
|
|
|
2020-03-15 23:00:29 +00:00
|
|
|
pdf_count=$(ls *.pdf | wc -l)
|
2020-03-15 22:40:38 +00:00
|
|
|
|
|
|
|
if [ $? -ne 0 ]; then
|
|
|
|
|
2020-03-15 23:00:29 +00:00
|
|
|
echo "<li>il doit y avoir un fichier PDF dans l'archive</li>"
|
2020-03-15 22:40:38 +00:00
|
|
|
errored=1
|
|
|
|
|
|
|
|
elif [ $pdf_count -ne 1 ]; then
|
|
|
|
|
2020-03-15 23:00:29 +00:00
|
|
|
echo "<li>il ne doit y avoir qu'un seul fichier PDF dans l'archive</li>"
|
2020-03-15 22:40:38 +00:00
|
|
|
errored=1
|
|
|
|
|
|
|
|
else
|
|
|
|
|
2020-03-15 23:00:29 +00:00
|
|
|
number_of_pages=$(pdfinfo *.pdf | grep Pages | cut -d ':' -f 2 | tr -d '[:space:]')
|
|
|
|
number_of_sounds=$(ls *.wav | wc -l)
|
2020-03-15 22:40:38 +00:00
|
|
|
|
|
|
|
if [ $? -ne 0 ]; then
|
2020-03-15 23:00:29 +00:00
|
|
|
echo "<li>il doit y avoir des fichiers .wav dans l'archive</li>"
|
2020-03-15 22:40:38 +00:00
|
|
|
errored=1
|
|
|
|
elif [ $number_of_sounds -ne $number_of_pages ]; then
|
2020-03-15 23:00:29 +00:00
|
|
|
echo "<li>il y a $number_of_sounds fichiers sonores mais $number_of_pages planches dans vos slides</li>"
|
2020-03-15 22:40:38 +00:00
|
|
|
errored=1
|
2020-03-15 22:45:50 +00:00
|
|
|
else
|
2020-03-15 23:00:29 +00:00
|
|
|
for i in `seq 0 $(($number_of_sounds - 1))`; do
|
|
|
|
echo $i
|
2020-03-15 22:45:50 +00:00
|
|
|
if ! [ -f $i.wav ]; then
|
2020-03-15 23:00:29 +00:00
|
|
|
echo "<li>les fichiers sonores doivent s'appeler 0.wav, 1.wav, 2.wav, etc...</li>"
|
|
|
|
errored=1
|
|
|
|
break
|
2020-03-15 22:45:50 +00:00
|
|
|
fi
|
|
|
|
done
|
2020-03-15 22:40:38 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
exit $errored
|