summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorian Pritz <bluewind@xinu.at>2015-05-31 14:32:47 +0200
committerFlorian Pritz <bluewind@xinu.at>2015-05-31 14:32:47 +0200
commite293f28d6608525e58df8c32636aea71b5fabba0 (patch)
treefbab57cc7fdcc5a63875c15c80cce9584aaab952
parent1812d700df5b1661f08daa0213fc4ac48e78f99b (diff)
downloadbin-e293f28d6608525e58df8c32636aea71b5fabba0.tar.gz
bin-e293f28d6608525e58df8c32636aea71b5fabba0.tar.xz
add flactomp3
Signed-off-by: Florian Pritz <bluewind@xinu.at>
-rwxr-xr-xflactomp319
1 files changed, 19 insertions, 0 deletions
diff --git a/flactomp3 b/flactomp3
new file mode 100755
index 0000000..8b61014
--- /dev/null
+++ b/flactomp3
@@ -0,0 +1,19 @@
+#!/bin/bash
+
+shopt -s globstar
+
+if (($# < 1)); then
+ echo "usage: ${0##*/} <directory>"
+ exit
+fi
+
+if [[ ! -d $1 ]]; then
+ echo "argument must be a directory"
+ exit 1
+fi
+
+dir=${1%/}
+copydir_suffix="_mp3"
+
+find "$dir" -type d -exec echo mkdir -p ${dir}${copydir_suffix}/{} +
+find "$dir" -type f -name '*.flac' -print0 | parallel -0 echo ffmpeg -i {} -qscale:a 0 '{=s#^([^/])(.*)\.flac$#\1'"${copydir_suffix}"'\2.mp3#=}'