-
-
Save sorokine/5281900 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
convert_dir=$1 | |
output_dir=$2 | |
bitrate=$3 | |
# Ensure require params are passed in | |
if [ -z $convert_dir ] || [ -z $output_dir ]; | |
then | |
echo "Usage: flac2mp3 rip_dir output_dir [bitrate]" | |
exit | |
fi | |
# Default to 320 kbps if bitrate not specified | |
if [ -z $bitrate ]; | |
then | |
bitrate=320 | |
fi | |
# Get the list of files to convert | |
files=( `find $convert_dir -iname '*.flac' | tr "\n" " "` ) | |
# Convert each file, one at a time | |
for file in ${files[*]} | |
do | |
flac -dc $file | lame -b $bitrate - $output_dir/`basename $file`.mp3 | |
done | |
echo "Conversions complete!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment