Files
oga-converter/oga-converter.sh
T

61 lines
1.3 KiB
Bash
Raw Normal View History

2016-04-23 02:03:59 +02:00
#!/bin/bash
# Copyright (c) 2016 Nicolás A. Ortega
# License: GNU GPLv3
2016-04-23 14:07:45 +02:00
while true
do
2016-04-24 00:14:58 +02:00
read -p "Should Oga-Converter confirm each conversion? (y/n) " ANSWER
2016-04-23 14:07:45 +02:00
case $ANSWER in
[yY]* ) CONFIRMATION=true
break;;
[nN]* ) CONFIRMATION=false
break;;
* ) echo "Please enter a valid option."
esac
done
2016-04-23 02:03:59 +02:00
for f in $@
do
2016-04-23 12:36:32 +02:00
OUTFILE=${f:0:-4}
2016-04-23 15:01:53 +02:00
echo "Convert $f to $OUTFILE.oga"
2016-04-23 14:07:45 +02:00
if $CONFIRMATION
then
while true
do
read -p "Do you wish to continue? (y/n) " ANSWER
case $ANSWER in
2016-04-23 15:01:53 +02:00
[yY]* ) ffmpeg -loglevel warning -i $f $OUTFILE.oga
2016-04-23 14:07:45 +02:00
break;;
2016-04-23 12:36:32 +02:00
2016-04-23 14:07:45 +02:00
[nN]* ) echo "Skipped file $f"
break;;
2016-04-23 12:36:32 +02:00
2016-04-23 14:07:45 +02:00
* ) echo "Please enter a valid option."
esac
done
else
2016-04-23 15:01:53 +02:00
ffmpeg -loglevel warning -i $f $OUTFILE.oga
2016-04-23 14:07:45 +02:00
fi
2016-04-23 02:03:59 +02:00
done
2016-04-24 00:14:58 +02:00
while true
do
read -p "Do you wish to delete the old files? (y/n) " ANSWER
case $ANSWER in
[yY]* ) echo "Deleting the old files..."
for f in $@
do
rm $f
done
echo "Done."
break;;
[nN]* ) echo "Goodbye!"
break;;
* ) echo "Please enter a valid option."
esac
done