From: Bastian Dehn Date: Sat, 5 Dec 2020 17:03:04 +0000 (+0100) Subject: remove: unnoetige funktionen entfernt X-Git-Tag: v1.0.0^2~68 X-Git-Url: https://gitweb.hhaalo.de/?a=commitdiff_plain;h=466838c07bc59c8f2395e27220ad1619ce9bbaf4;p=albentohandy.git remove: unnoetige funktionen entfernt --- diff --git a/albentohandy b/albentohandy index 574c012..cc0d412 100755 --- a/albentohandy +++ b/albentohandy @@ -12,21 +12,16 @@ NAME albumtohandy - konvertiert flac to mp3 von einer Sammlung SYNOPSIS - albentohandy [-c] [-i ]/[,[]/]..] [-r] [-z input Datei default=albumlist -m kopiert das Arbeitsverzeichnis in das angegeben Zielverzeichnis - -S []/ parallel mehr information - in der Manpage von parallel -r löscht das Arbeitsverzeichnis - wenn -z oder -m angegeben ist + wenn -m angegeben ist -w das Arbeitsverzeichnis angegeben - -z erstellt ein Zip Datei EOF } @@ -40,10 +35,9 @@ MakeSymlinksToWork() for i in $(cat "$albumlist"); do cp --recursive --symbolic-link $musicdir/$i $workdir/ rsync --recursive --perms --times --group --owner \ - --exclude="*.flac" --exclude="*.mp3" \ + --exclude="*.flac" --exclude="*.mp3" --exclude="*.ogg" \ --include="cover.jpg" $musicdir/$i $workdir/ done - } ReadFlacToOggTags() @@ -54,6 +48,7 @@ ReadFlacToOggTags() 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 @@ -65,7 +60,6 @@ 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" - @@ -84,7 +78,6 @@ ConvertFlacToOgg() { local readonly workdir="$1" local readonly paralleopts="$2" - local readonly scriptdir="$3" export -f FlacToVorbis export -f ReadFlacToOggTags @@ -165,32 +158,9 @@ CopyWorkDirToDestDir() cp --recursive $workdir/* $destdir } -MakeZipFile() -{ - local readonly workdir="$1" - local zipname="$2" - - if [[ ! $zipname =~ .zip ]]; then - local zipname="${zipname}.zip" - fi - - local readonly curpath=$(pwd) - cd $workdir - 7z a -bd -mmt=off -mm=Copy $curpath/$zipname . - cd $curpath -} - -MakeSha256CheckSum() -{ - local readonly workdir="$1" - - find $workdir -name '*.mp3' | sort | xargs sha256sum \ - | sed "s=$workdir/==" >> $workdir/sha256sum -} - LoadConfig() { - # .albentohandy.conf: set SCRIPTPATH and MUSICPATH + # .albentohandy.conf: set MUSICPATH if [ -f $HOME/.albentohandy.conf ]; then source $HOME/.albentohandy.conf else @@ -202,7 +172,7 @@ LoadConfig() ExistsBasicProgramms() { local exists=true - local programms=("eyeD3" "flac" "lame" "sha256sum" "7z" "parallel") + local programms=("vorbiscomment" "flac" "oggenc" "parallel") for programm in $programms; do if [ ! -f /usr/bin/$programm ]; then @@ -222,20 +192,14 @@ SetDefaultVariables() parallelopts=":" curphase=1 phase=3 - checksum=false - mkzip=false removework=false cptodest=false } ReadArguments() { - while getopts "chi:m:S:rw:z:" optname; do + while getopts "hi:m:rw:" optname; do case "$optname" in - "c") - checksum=true - ((phase++)) - ;; "h") Usage exit 0 @@ -248,20 +212,12 @@ ReadArguments() dest="$OPTARG" ((phase++)) ;; - "S") - parallelopts="$OPTARG" - ;; "r") removework=true ;; "w") WORK="$OPTARG" ;; - "z") - mkzip=true - zipname="$OPTARG" - ((phase++)) - ;; esac done } @@ -303,22 +259,6 @@ ConvertProcess() AdvancedFeatures() { - # create sha256sum in working directory - if [ $checksum == true ]; then - printf "Phase %02d of %02d: " $((curphase++)) $phase - printf "create sha256sum\n\n" - MakeSha256CheckSum "$WORK" - fi - - # make zipfile in the current path - # content of zipfile is content of working directory - if [ $mkzip == true ]; then - printf "Phase %02d of %02d: " $((curphase++)) $phase - printf " create %s\n" $zipname - MakeZipFile "$WORK" "$zipname" - printf "\n" - fi - # copy work directory to destination folder if [ $cptodest == true ]; then printf "Phase %02d of %02d:\n" $((curphase++)) $phase @@ -327,8 +267,7 @@ AdvancedFeatures() fi # delete the working directory - if ([ $mkzip == true ] || [ $cptodest == true ]) \ - && [ $removework == true ]; then + if [ $cptodest == true ] && [ $removework == true ]; then CleanupWorkDir "$WORK" fi } @@ -336,7 +275,6 @@ AdvancedFeatures() main() { WORK="$(pwd)/work.$$" # temporary working directory - SCRIPTPATH="/usr/bin" # path to flactomp3v2 and notify.sh script MUSICPATH="/tmp/musikpath" # flac collection directory ExistsBasicProgramms