]> gitweb.hhaalo.de Git - albentohandy.git/commitdiff
remove: notify.sh
authorBastian Dehn <hhaalo@arcor.de>
Sat, 25 Nov 2017 07:16:04 +0000 (08:16 +0100)
committerBastian Dehn <hhaalo@arcor.de>
Sat, 25 Nov 2017 07:20:45 +0000 (08:20 +0100)
Makefile
albentohandy
notify.sh [deleted file]

index 8fe9b705cec0f5a31722fc07d3967aa6d2c1de7b..7a4eb78c957e8c2ce8a03e881d5fa0bebf2fd139 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -7,8 +7,6 @@ install:
        cp flactomp3v2 $(BINPATH)/flactomp3v2
        chmod 755 $(BINPATH)/flactomp3v2
        cp man/albentohandy.1 $(MANPATH)/albentohandy.1
-       cp notify.sh $(BINPATH)/notify.sh
-       chmod 755 $(BINPATH)/notify.sh
        gzip $(MANPATH)/albentohandy.1
        cp man/albentohandy.conf.1 $(MANPATH)/albentohandy.conf.1
        gzip $(MANPATH)/albentohandy.conf.1
@@ -17,7 +15,6 @@ install:
 uninstall:
        rm $(BINPATH)/albentohandy
        rm $(BINPATH)/flactomp3v2
-       rm $(BINPATH)/notify.sh
        rm $(MANPATH)/albentohandy.1.gz
        rm $(MANPATH)/albentohandy.conf.1.gz
        rm $(MANPATH)/flactomp3v2.conf.1.gz
index 9adc402aa6fdc58ade6f0983bef5073901e38fb5..eae99522552331e1b25713a3a4f397bc98a602ad 100755 (executable)
@@ -106,14 +106,6 @@ ExistsScripts() {
                printf "\nERROR\nflactomp3v2 do not found in %s\n" $scriptdir
                exit 1
        fi
-
-       # notify.sh: functions send email
-       if [ ! -f $scriptdir/notify.sh ]; then
-               printf "\nERROR\nnotify.sh do not found in %s\n" $scriptdir
-               exit 1
-       else
-               source $scriptdir/notify.sh
-       fi
 }
 
 LoadConfig() {
@@ -219,6 +211,23 @@ ReadArguments() {
        done
 }
 
+ExistsAlbumlist() {
+       local albumlist="$1"
+
+       if [ ! -f "$albumlist" ]; then
+               printf "\nalbumlist does not exists\n\n"
+               exit
+       fi
+}
+
+CreateWorkDirectory() {
+       local WORK="$1"
+
+       if [ ! -d $WORK ]; then
+               mkdir $WORK
+       fi
+}
+
 main() {
        WORK="$(pwd)/work.$$" # temporary working directory
        SCRIPTPATH="/usr/bin" # path to flactomp3v2 and notify.sh script
@@ -226,101 +235,49 @@ main() {
 
        ExistsBasicProgramms
        LoadConfig
-
        ExistsScripts "$SCRIPTPATH"
-
        SetDefaultVariables
 
        ReadArguments $*
 
-       # check albumlist is set
-       if [ ! -f "$albumlist" ]; then
-               printf "\nalbumlist does not exists\n\n"
-               exit
-       fi
-
-       # create working directory
-       if [ ! -d $WORK ]; then
-               mkdir $WORK
-       fi
+       ExistsAlbumlist "$albumlist"
+       CreateWorkDirectory "$WORK"
 
-       openMail
-       addInfo "<p>"
-       currentDate
-       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:\n" $((curphase++)) $phase
+       printf "create symlinks of flac's in %s\n" "$WORK"
        MakeSymlinksToWork "$WORK" "$MUSICPATH" "$albumlist"
 
-       addInfo "<p>"
-       currentDate
-       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
-
        ConvertFlacToMp3 "$WORK" "$BASEFILE" "$parallelopts" "$SCRIPTPATH"
 
-       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
        CleanupFlacAndCovers "$WORK"
 
        # 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
-
                MakeSha256CheckSum "$WORK"
-
-               currentDate
-               addInfo "sha256sum is created</p>"
        fi
 
        # make zipfile in the current path
        # content of zipfile is content of working directory
        if [ $mkzip == true ]; then
                printf "Phase %02d of %02d: create %s\n" $((curphase++)) $phase $zipname
-               addInfo "<p>"
-               currentDate
-               addInfo "create $zipname start<br>"
-
                MakeZipFile "$WORK" "$zipname"
-
                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>"
-
+               printf "Phase %02d of %02d:\n" $((curphase++)) $phase
+           printf "copy %s/ to destination %s\n\n" $WORK $dest
                CopyWorkDirToDestDir "$WORK" "$dest"
-
-               currentDate
-               addInfo "copy from $WORK to $dest finished</p>"
        fi
 
        # delete the working directory
-       if ( [ $mkzip == true ] || [ $cptodest == true ] ) && [ $removework == true ]; then
+       if ( [ $mkzip == true ] || [ $cptodest == true ] ) && [ $removework == true ]; then
                CleanupWorkDir "$WORK"
        fi
-
-       addInfo "<p>"
-       currentDate
-       addInfo "send email</p>"
-       closeMail
-       sendEmail
 }
 
 main $*
diff --git a/notify.sh b/notify.sh
deleted file mode 100755 (executable)
index 2155243..0000000
--- a/notify.sh
+++ /dev/null
@@ -1,53 +0,0 @@
-#!/bin/bash
-### Script is include in albentohandy to send notify.
-### Here is the Basic functions to send mail.
-### albentohandy.conf must have parameters for smtp
-
-# default no notify
-# it will be set in .ablentohandy.conf
-NOTIFY=false
-MESSAGE=""
-
-# load all parameters to sendemail over smtp
-# NOTIFY; FROMADDRESS; TOADDRESS; STMP; SMPTUSERNAME; SMTPPASSWORD(base64)
-if [ ! -f $HOME/.albentohandy.conf ]; then
-       printf "\nERROR\n.albentohandy.conf does not exist\n"
-       exit 1
-else
-       source $HOME/.albentohandy.conf
-fi
-
-# send email to notify user
-sendEmail() {
-       if [ $NOTIFY == true ]; then
-               sendemail -f $FROMADDRESS -t $TOADDRESS \
--s $SMTP -xu $SMTPUSERNAME -xp $(echo $SMTPPASSWORD | base64 --decode) -o tls=yes \
--u "albentohandy" -o message-content-type=html -m "$MESSAGE"
-       fi
-}
-
-# add current date in message
-currentDate() {
-       MESSAGE="${MESSAGE}$(date +"%Y-%m-%d %H:%M:%S") "
-}
-
-# open html, header and body
-openMail() {
-       MESSAGE="<html>\n \
-<head>\n \
-<title>albentohandy.sh notify</title>\n \
-</head>\n \
-<body>\n"
-}
-
-# write message
-addInfo() {
-       MESSAGE="${MESSAGE}$1\n"
-}
-
-# close body andy html
-closeMail() {
-       MESSAGE="${MESSAGE}\n \
-</body>\n \
-</html>\n"
-}