From: Mike Frysinger Date: Sat, 25 Feb 2012 21:51:36 +0000 (-0500) Subject: flac2mp3 helper X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=4a055602e9e0994c2f59bd777e05a545199a10fd;p=home.git flac2mp3 helper --- diff --git a/.bin/flac2mp3 b/.bin/flac2mp3 new file mode 100755 index 0000000..5fbbdd6 --- /dev/null +++ b/.bin/flac2mp3 @@ -0,0 +1,22 @@ +#!/bin/bash + +maxj=4 +jobs=() + +[[ $# -eq 0 ]] && set -- *.flac + +for f in "$@" ; do + m="${f%.flac}.mp3" + ( + flac -sdc "${f}" | \ + lame --silent -V 0 -h - "${m}" + id3cp "${f}" "${m}" + ) & + jobs+=( $! ) + if [[ ${#jobs[@]} -eq ${maxj} ]] ; then + wait ${jobs[0]} + jobs=( ${jobs[@]:1} ) + fi +done + +wait