From 31cc70596c08fdfb81494fcd6c0b748c69b31915 Mon Sep 17 00:00:00 2001 From: Bastian Dehn Date: Sat, 5 Dec 2020 17:11:13 +0100 Subject: [PATCH] remove: flactovorbis integration in albentohandy --- albentohandy | 39 ++++++++++++++++++++++++++++++++++++++- flactovorbis | 38 -------------------------------------- 2 files changed, 38 insertions(+), 39 deletions(-) delete mode 100755 flactovorbis diff --git a/albentohandy b/albentohandy index 908be81..2eeb430 100755 --- a/albentohandy +++ b/albentohandy @@ -46,16 +46,53 @@ MakeSymlinksToWork() } +ReadFlacToOggTags() +{ + local readonly INPUTFILE="$1" + local readonly OUTPUFILE="$2" + local readonly COVERFILE="${INPUTFILE%/*}/cover.txt" + + metaflac --export-tags-to=- $INPUTFILE \ + | vorbiscomment --commentfile - --write $OUTPUTFILE + if [ -f $COVERFILE ]; then + echo "METADATA_BLOCK_PICTURE=$(base64 --wrap 0 $COVERFILE)" \ + | vorbiscomment --commentfile - --raw --append $OUTPUTFILE + fi +} + +EncodingFlacToOgg() +{ + local readonly INPUTFILE="$1" + local readonly OUTPUTFILE="$2" + + # stream flac into the ogg vorbis + nice --adjustment=10 flac --silent --stdout --decode "$INPUTFILE" \ + | nice --adjustment=15 oggenc --quiet --quality 6 \ + --output "$OUTPUTFILE" - +} + +FlacToVorbis() +{ + local readonly INPUTFILE="$1" + local readonly OUTPUTFILE="${INPUTFILE[@]/%flac/ogg}" + + EncodingFlacToOgg "$INPUTFILE" "$OUTPUTFILE" + ReadFlacToOggTags "$INPUTFILE" "$OUTPUTFILE" +} + ConvertFlacToOgg() { local readonly workdir="$1" local readonly paralleopts="$2" local readonly scriptdir="$3" + export -f FlacToVorbis + export -f ReadFlacToOggTags + export -f EncodingFlacToOgg find $workdir -name '*.flac' \ | sort \ | parallel --will-cite --ungroup --eta --progress \ - --sshlogin $parallelopts $scriptdir/flactovorbis {} + --sshlogin $parallelopts FlacToVorbis {} } ConvertCoverToMeta() diff --git a/flactovorbis b/flactovorbis deleted file mode 100755 index aa34de6..0000000 --- a/flactovorbis +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/bash - -ReadFlacToOggTags() -{ - local readonly INPUTFILE="$1" - local readonly OUTPUFILE="$2" - local readonly COVERFILE="${INPUTFILE%/*}/cover.txt" - - metaflac --export-tags-to=- $INPUTFILE \ - | vorbiscomment --commentfile - --write $OUTPUTFILE - if [ -f $COVERFILE ]; then - echo "METADATA_BLOCK_PICTURE=$(base64 --wrap 0 $COVERFILE)" \ - | vorbiscomment --commentfile - --raw --append $OUTPUTFILE - fi -} - -EncodingFlacToOgg() -{ - local readonly INPUTFILE="$1" - local readonly OUTPUTFILE="$2" - - # stream flac into the ogg vorbis - nice --adjustment=10 flac --silent --stdout --decode "$INPUTFILE" \ - | nice --adjustment=15 oggenc --quiet --quality 6 \ - --output "$OUTPUTFILE" - -} - -main() -{ - local readonly INPUTFILE="$1" - local readonly OUTPUTFILE="${INPUTFILE[@]/%flac/ogg}" - - EncodingFlacToOgg "$INPUTFILE" "$OUTPUTFILE" - ReadFlacToOggTags "$INPUTFILE" "$OUTPUTFILE" -} - -main "$1" -exit 0 -- 2.47.3