Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
executable file 23 lines (15 sloc) 663 Bytes
#!/bin/zsh
# Written by Nick Welch <nick@incise.org>. Author disclaims copyright.
# TranscodeToMP3: recursively find all files in the current directory with the
# specified extension (the only argument) and convert them to mp3, using
# mplayer to decode them, changing the extension to .mp3 in the new files'
# filenames and leaving the original files intact.
glob="$1"
threads=$(( `grep -c ^processor /proc/cpuinfo` * 2 ))
if [ "$glob" = "*.mp3" ]
then
echo "don't do that, it'll overwrite your files"
exit 1
fi
echo "launching $threads threads at a time..."
find . -name "$glob" -type f -print0 | sort -z | xargs -0 -n1 -P$threads TranscodeFile