From: Bastian Dehn
Date: Sun, 16 Jul 2017 13:48:29 +0000 (+0200)
Subject: change: global vars uppercase
X-Git-Tag: v1.0.0^2~103
X-Git-Url: https://gitweb.hhaalo.de/?a=commitdiff_plain;h=d4f8017339ad1c18582c4d5ece5f10e9b351fb33;p=albentohandy.git
change: global vars uppercase
---
diff --git a/albentohandy b/albentohandy
index 634f6c1..6a7f60b 100755
--- a/albentohandy
+++ b/albentohandy
@@ -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
"
addInfo "Foldende Alben wurden ausgewählt:
"
addInfo "$(cat "$albumlist" | sed 's/$/
/')
"
# 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 ""
@@ -107,14 +107,14 @@ addInfo "flac -> mp3 start
"
# 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 -> mp3 finished
"
# 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
"
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"
fi
@@ -138,7 +138,7 @@ if [ $mkzip == true ]; then
currentDate
addInfo "create $zipname start
"
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 ""
currentDate
- addInfo "copy from $work to $dest start
"
+ addInfo "copy from $WORK to $dest start
"
mkdir --parents $dest
- cp --recursive $work/* $dest
+ cp --recursive $WORK/* $dest
currentDate
- addInfo "copy from $work to $dest finished
"
+ addInfo "copy from $WORK to $dest finished"
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 ""