]> git.wh0rd.org Git - home.git/commitdiff
flac2mp3 helper
authorMike Frysinger <vapier@gentoo.org>
Sat, 25 Feb 2012 21:51:36 +0000 (16:51 -0500)
committerMike Frysinger <vapier@gentoo.org>
Sat, 28 Apr 2012 19:36:44 +0000 (15:36 -0400)
.bin/flac2mp3 [new file with mode: 0755]

diff --git a/.bin/flac2mp3 b/.bin/flac2mp3
new file mode 100755 (executable)
index 0000000..5fbbdd6
--- /dev/null
@@ -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