From 4a055602e9e0994c2f59bd777e05a545199a10fd Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Sat, 25 Feb 2012 16:51:36 -0500 Subject: [PATCH] flac2mp3 helper --- .bin/flac2mp3 | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100755 .bin/flac2mp3 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 -- 2.39.5