]> gitweb.hhaalo.de Git - albentohandy.git/commitdiff
change: global vars uppercase
authorBastian Dehn <hhaalo@arcor.de>
Sun, 16 Jul 2017 13:48:29 +0000 (15:48 +0200)
committerBastian Dehn <hhaalo@arcor.de>
Sun, 16 Jul 2017 13:48:29 +0000 (15:48 +0200)
albentohandy

index 634f6c19981743bff2bcc5e8915bfe721a484f0b..6a7f60bcc82f1f8b5025f8246fad8977ebc01dc8 100755 (executable)
@@ -4,12 +4,12 @@
 ### copy to other folder. It works on parallel, you can
 ### use it in a cluster with Parameter -S.
 
-work="$(pwd)/work.$$" # temporary working directory
-scriptpath="/usr/bin" # path to flactomp3v2 and notify.sh script
-musicpath="/tmp/musikpath" # flac collection directory
+WORK="$(pwd)/WORK.$$" # temporary working directory
+SCRIPTPATH="/usr/bin" # path to flactomp3v2 and notify.sh script
+MUSICPATH="/tmp/musikpath" # flac collection directory
 
 # check exist config and scripts
-# .albentohandy.conf: set scriptpath and musicpath
+# .albentohandy.conf: set SCRIPTPATH and MUISCPATH
 if [ -f $HOME/.albentohandy.conf ]; then
        source $HOME/.albentohandy.conf
 else
@@ -17,16 +17,16 @@ else
        exit 1
 fi
 # flactomp3v2: convert flac's to mp3
-if [ ! -f $scriptpath/flactomp3v2 ]; then
-       printf "\nERROR\nflactomp3v2 do not found in %s\n" $scriptpath
+if [ ! -f $SCRIPTPATH/flactomp3v2 ]; then
+       printf "\nERROR\nflactomp3v2 do not found in %s\n" $SCRIPTPATH
        exit 1
 fi
 # notify.sh: functions send email
-if [ ! -f $scriptpath/notify.sh ]; then
-       printf "\nERROR\nnotify.sh do not found in %s\n" $scriptpath
+if [ ! -f $SCRIPTPATH/notify.sh ]; then
+       printf "\nERROR\nnotify.sh do not found in %s\n" $SCRIPTPATH
        exit 1
 else
-       source $scriptpath/notify.sh
+       source $SCRIPTPATH/notify.sh
 fi
 
 # set defaults
@@ -68,7 +68,7 @@ while getopts ":ci:m:S::rw:z:" optname; do
                removework=true
                ;;
        "w")
-               work="$OPTARG"
+               WORK="$OPTARG"
                ;;
        "z")
                mkzip=true
@@ -85,8 +85,8 @@ if [ ! -f "$albumlist" ]; then
 fi
 
 # create working directory
-if [ ! -d $work ]; then
-       mkdir $work
+if [ ! -d $WORK ]; then
+       mkdir $WORK
 fi
 
 openMail
@@ -96,9 +96,9 @@ addInfo "albentohandy.sh is started</p>"
 addInfo "<p>Foldende Alben wurden ausgew&auml;hlt:</p>"
 addInfo "<p>$(cat "$albumlist" | sed 's/$/<br>/')</p>"
 # make symlinks of original flac's in working directory
-printf "\nPhase %02d of %02d: create symlinks of flac's to working directory %s\n" $((curphase++)) $phase "$work"
+printf "\nPhase %02d of %02d: create symlinks of flac's to working directory %s\n" $((curphase++)) $phase "$WORK"
 for i in $(cat "$albumlist"); do
-       cp --recursive --symbolic-link $musicpath/$i $work/
+       cp --recursive --symbolic-link $MUISCPATH/$i $WORK/
 done
 
 addInfo "<p>"
@@ -107,14 +107,14 @@ addInfo "flac -&gt; mp3 start<br>"
 # convert flac to mp3
 # it is the longest phase
 printf "\nPhase %02d of %02d: flac -> mp3\n" $((curphase++)) $phase
-find $work -name '*.flac' | sort | parallel $BASEFILE --will-cite --ungroup --eta --progress --sshlogin $parallelopts $scriptpath/flactomp3v2 {}
+find $WORK -name '*.flac' | sort | parallel $BASEFILE --will-cite --ungroup --eta --progress --sshlogin $parallelopts $SCRIPTPATH/flactomp3v2 {}
 currentDate
 addInfo "flac -&gt; mp3 finished</p>"
 
 # removing flac and cover.jpg
 printf "\nPhase %02d of %02d: remove flac's and cover's\n\n" $((curphase++)) $phase
-find $work -name '*.flac' | sort | xargs rm
-find $work -name 'cover*' | sort | xargs rm
+find $WORK -name '*.flac' | sort | xargs rm
+find $WORK -name 'cover*' | sort | xargs rm
 
 # create sha256sum in working directory
 if [ $checksum == true ]; then
@@ -122,7 +122,7 @@ if [ $checksum == true ]; then
        currentDate
        addInfo "create sha256sum is start<br>"
        printf "Phase %02d of %02d: create sha256sum\n\n" $((curphase++)) $phase
-       find $work -name '*.mp3' | sort | xargs sha256sum | sed "s=$work/==" >> $work/sha256sum
+       find $WORK -name '*.mp3' | sort | xargs sha256sum | sed "s=$WORK/==" >> $WORK/sha256sum
        currentDate
        addInfo "sha256sum is created</p>"
 fi
@@ -138,7 +138,7 @@ if [ $mkzip == true ]; then
        currentDate
        addInfo "create $zipname start<br>"
        curpath=$(pwd)
-       cd $work
+       cd $WORK
        7z a -bd -mmt=off -mm=Copy $curpath/$zipname .
        cd $curpath
        printf "\n"
@@ -148,20 +148,20 @@ fi
 
 # copy work directory to destination folder
 if [ $cptodest == true ]; then
-       printf "Phase %02d of %02d: copy %s/ to destination %s\n\n" $((curphase++)) $phase $work $dest
+       printf "Phase %02d of %02d: copy %s/ to destination %s\n\n" $((curphase++)) $phase $WORK $dest
        addInfo "<p>"
        currentDate
-       addInfo "copy from $work to $dest start<br>"
+       addInfo "copy from $WORK to $dest start<br>"
        mkdir --parents $dest
-       cp --recursive $work/* $dest
+       cp --recursive $WORK/* $dest
        currentDate
-       addInfo "copy from $work to $dest finished</p>"
+       addInfo "copy from $WORK to $dest finished</p>"
 fi
 
 # delete the working directory
 if ( [ $mkzip == true ] || [ $cptodest == true ] ) && [ $removework == true ]; then
        printf "cleanup working directory\n\n"
-       rm --recursive $work
+       rm --recursive $WORK
 fi
 
 addInfo "<p>"