Ask if the user wants to confirm all files.

Pressing `y' on all those files might be annoying.
This commit is contained in:
Nicolás A. Ortega 2016-04-23 14:07:45 +02:00
parent eb170a08f9
commit 6a75f0aa71
No known key found for this signature in database
GPG Key ID: 4825F773B8D44EFF

View File

@ -2,21 +2,40 @@
# Copyright (c) 2016 Nicolás A. Ortega # Copyright (c) 2016 Nicolás A. Ortega
# License: GNU GPLv3 # License: GNU GPLv3
while true
do
read -p "Should Ogg-Converter confirm each conversion? (y/n)" ANSWER
case $ANSWER in
[yY]* ) CONFIRMATION=true
break;;
[nN]* ) CONFIRMATION=false
break;;
* ) echo "Please enter a valid option."
esac
done
for f in $@ for f in $@
do do
OUTFILE=${f:0:-4} OUTFILE=${f:0:-4}
echo "Convert $f to $OUTFILE.ogg" echo "Convert $f to $OUTFILE.ogg"
while true if $CONFIRMATION
do then
read -p "Do you wish to continue? (y/n) " ANSWER while true
case $ANSWER in do
[yY]* ) ffmpeg -loglevel warning -i $f $OUTFILE.ogg read -p "Do you wish to continue? (y/n) " ANSWER
break;; case $ANSWER in
[yY]* ) ffmpeg -loglevel warning -i $f $OUTFILE.ogg
break;;
[nN]* ) echo "Skipped file $f" [nN]* ) echo "Skipped file $f"
break;; break;;
* ) echo "Please enter a valid option." * ) echo "Please enter a valid option."
esac esac
done done
else
ffmpeg -loglevel warning -i $f $OUTFILE.ogg
fi
done done