From ff39c9d072c038e0b43d12c3bf9ac0dc924d5c6e Mon Sep 17 00:00:00 2001 From: Bastian Dehn Date: Mon, 14 Jul 2025 16:53:53 +0200 Subject: [PATCH] add convert to opus --- albentohandy | 32 ++++++++++++++++++++------------ 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/albentohandy b/albentohandy index f101f41..a89f07e 100755 --- a/albentohandy +++ b/albentohandy @@ -135,24 +135,28 @@ ConvertFlacToMp3() #### END MP3 #### #### BEGIN OPUS #### -FlacToOpus() +flac_to_opus() { - local readonly INPUTFILE="$1" - local readonly OUTPUTFILE="${INPUTFILE[@]/%flac/opus}" - local readonly COVERFILE="${INPUTFILE%/*}/cover.jpg" + local inputfile="$1" + local outputfile="${inputfile/.flac/.opus}" + local coverfile="${inputfile%/*}/cover.jpg" - nice --adjustment=10 opusenc --picture "3|image/jpeg|||$COVERFILE" \ - --quiet --bitrate 192 "$INPUTFILE" "$OUTPUTFILE" + nice --adjustment=10 opusenc --picture "3|image/jpeg|||$coverfile" \ + --quiet --bitrate 192 "$inputfile" "$outputfile" } -ConvertFlacToOpus() +convert_flac_to_opus() { - local readonly WORKDIR="$1" + local workdir="$1" - declare -xf FlacToOpus - find $WORKDIR -name *.flac \ + export -f flac_to_opus + find $workdir -name *.flac \ | sort \ - | parallel --will-cite --ungroup --eta --progress FlacToOpus {} + | parallel --will-cite \ + --ungroup \ + --eta \ + --progress \ + flac_to_opus {} } #### END OPUS #### @@ -409,7 +413,11 @@ convert_process() picture_to_flac "$workdir" cleanup_cover "$workdir" ;; - "opus") ;; + "opus") + convert_flac_to_opus "$workdir" + cleanup_flac "$workdir" + cleanup_cover "$workdir" + ;; *) convert_cover_to_metadata "$workdir" convert_flac_to_ogg "$workdir" -- 2.47.3