printf "\nERROR\nflactomp3v2.sh do not found in %s\n" $scriptpath
exit 1
fi
+if [ ! -f $scriptpath/notify.sh ]
+then
+ printf "\nERROR\nnotify.sh do not found in %s\n" $scriptpath
+ exit 1
+else
+ source $scriptpath/notify.sh
+fi
# set defaults
albumlist="albumlist"
mkdir $work
fi
+openMail
+addInfo "<p>"
+currentDate
+addInfo "albentohandy.sh is started</p>"
+addInfo "<p>Foldende Alben wurden ausgewählt:</p>"
+addInfo "<p>$(cat "$albumlist" | sed 's/$/<br>/')</p>"
# make symlinks of original flac's
printf "\nPhase %02d of %02d: create symlinks of flac's to working directory %s\n" $((curphase++)) $phase "$work"
for i in $(cat "$albumlist")
# convert flac to mp3
# it is the longest phase
+addInfo "<p>"
+currentDate
+addInfo "flac -> mp3 start<br>"
printf "\nPhase %02d of %02d: flac -> mp3\n" $((curphase++)) $phase
find $work -name '*.flac' | sort | parallel $BASEFILE --eta --progress --noswap -S $parallelopts $scriptpath/flactomp3v2.sh {}
+currentDate
+addInfo "flac -> mp3 finished</p>"
# removing flac and cover.jpg
printf "\nPhase %02d of %02d: remove flac's and cover's\n\n" $((curphase++)) $phase
# create sha256sum in working directory
if [ $checksum == true ]
then
+ addInfo "<p>"
+ 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
+ currentDate
+ addInfo "sha256sum is created</p>"
fi
# make zipfile in the current path
then
zipname="${zipname}.zip"
fi
+ addInfo "<p>"
+ currentDate
+ addInfo "create $zipname start<br>"
curpath=$(pwd)
cd $work
7z a -bd -mmt=off -mm=Copy $curpath/$zipname .
cd $curpath
printf "\n"
+ currentDate
+ addInfo "$zipname is created</p>"
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
+ addInfo "<p>"
+ currentDate
+ addInfo "copy from $work to $dest start<br>"
if [ ! -d $dest ]
then
mkdir -p $dest
fi
cp -r $work/* $dest
+ currentDate
+ addInfo "copy from $work to $dest finished</p>"
fi
# delete the working directory
rm -r $work
fi
+addInfo "<p>"
+currentDate
+addInfo "send email</p>"
+closeMail
+sendEmail
+
exit 0