Last active
December 10, 2015 16:09
-
-
Save aslakhellesoy/4459281 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
| # Usage: flac16.sh SOURCEDIR DESTDIR | |
| # DESTDIR should have no spaces since sox chokes on it. | |
| set -e | |
| SOURCEDIR=$1 | |
| DESTDIR=$(cd $(dirname "$2"); pwd)/$(basename "$2") | |
| cd "$SOURCEDIR" | |
| rm -f tmp_flac16_source.flac | |
| for file in *.flac | |
| do | |
| BASENAME=$(basename "$file") | |
| DESTFILE=$DESTDIR/$BASENAME | |
| # sox doesn't like weird characters in file names | |
| ln -s "$file" tmp_flac16_source.flac | |
| # growl the title | |
| TITLE=`soxi -a tmp_flac16_source.flac | grep TITLE | cut -d "=" -f 2` | |
| growlnotify -n flac16_song -m "$TITLE" "Converting..." | |
| # convert to a nice name | |
| sox -S tmp_flac16_source.flac -r 44100 -b 16 tmp_flac16_dest.flac | |
| # move it to where we want it | |
| mv tmp_flac16_dest.flac "$DESTFILE" | |
| # clean up | |
| rm -f tmp_flac16_source.flac | |
| done | |
| growlnotify -n flac16_album -m "$SOURCEDIR" "Done!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment