summaryrefslogtreecommitdiffstats
path: root/flactomp3
diff options
context:
space:
mode:
Diffstat (limited to 'flactomp3')
-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#=}'