diff --git a/encode_all b/encode_all
index 13ae904..f5efffe 100755
--- a/encode_all
+++ b/encode_all
@@ -144,10 +144,18 @@ function encode() {
'--tracknumber' "${tags['TRACKNUMBER']}"
'--date' "${album_date}")
[[ -n "${tags[DISK]}" ]] && tag_flags+=('--comment' "DISK=${tags['DISK']}")
+ tags=''
+ for tag in "${tag_flags[@]}"; do
+ tags+="$(printf '"%s" ' "$tag")"
+ done
if [[ "$debug_only" == 'false' ]]; then
- err="$(opusenc --quiet --discard-comments --discard-pictures "${tag_flags[@]}" "$file" "$final_opus" 2>&1)"
+ # err="$(opusenc --quiet --discard-comments --discard-pictures "${tag_flags[@]}" "$file" "$final_opus" 2>&1)"
+ cmd=$(printf 'opusenc --quiet --discard-comments --discard-pictures %s "%s" "%s"\n' "$tags" "$file" "$final_opus")
+ printf '%s\n' "$cmd"
+ eval $cmd
else
- echo opusenc --quiet --discard-comments --discard-pictures "${tag_flags[@]}" "$file" "$final_opus"
+ cmd=$(printf 'opusenc --quiet --discard-comments --discard-pictures %s "%s" "%s"\n' "$tags" "$file" "$final_opus")
+ printf '%s\n' "$cmd"
fi
if [[ -n "$err" ]]; then
printf '%s\n' "$err" >> "$log"
diff --git a/encode_dir b/encode_dir
new file mode 100755
index 0000000..141db9f
--- /dev/null
+++ b/encode_dir
@@ -0,0 +1,90 @@
+#!/bin/bash
+# encode_all encodes the whole library into specified format
+#
+ulimit -n "$(ulimit -Hn)"
+. env_parallel.bash
+
+function ts() {
+ date '+%Y-%m-%d_%H:%M'
+}
+
+debug_only=false
+# debug_only=true
+src_dir="$1"
+export output_dir="$2"
+if [[ -z "$src_dir" || -z "$output_dir" ]]; then
+ printf 'Usage:\nencode_dir