]> gitweb.hhaalo.de Git - albentohandy.git/commitdiff
change lib flac with array
authorBastian Dehn <hhaalo@arcor.de>
Sun, 6 Sep 2026 16:28:04 +0000 (18:28 +0200)
committerBastian Dehn <hhaalo@arcor.de>
Sun, 6 Sep 2026 16:28:04 +0000 (18:28 +0200)
libs/flac.sh

index 98105e97225023018f69099f02082af8ca86f438..a493840618f774f68654ec8f73b455702b83106d 100644 (file)
@@ -3,18 +3,18 @@
 picture_to_flac()
 {
        local workdir="$1"
-       local flacfiles=
-       flacfiles="$(find "$workdir" -name '*.flac' | sort)"
+       local flacs=()
+       mapfile -t flacs < <(find "$workdir" -name '*.flac' | sort)
 
        local file=
-       local outputfile=
-       for file in $flacfiles; do
-               outputfile=${file/.flac/-out.flac}
+       local output=
+       for file in "${flacs[@]}"; do
+               output=${file/.flac/-out.flac}
                metaflac \
                --import-picture-from="3|image/jpeg|||${file%/*}/cover.jpg" \
-               --output-name "$outputfile" \
+               --output-name "$output" \
                "$file"
-               mv "$outputfile" "$file"
+               mv "$output" "$file"
        done
 }