From: Bastian Dehn Date: Sun, 17 Jul 2016 22:28:30 +0000 (+0200) Subject: add: comments in notify.sh and correction comments X-Git-Tag: v1.0.0^2~126 X-Git-Url: https://gitweb.hhaalo.de/?a=commitdiff_plain;h=3a6518c24c2f9fe4c641a135b9a5963f30451f93;p=albentohandy.git add: comments in notify.sh and correction comments --- diff --git a/albentohandy.sh b/albentohandy.sh index a1bf71c..c4b0e6d 100755 --- a/albentohandy.sh +++ b/albentohandy.sh @@ -1,14 +1,11 @@ #!/bin/bash -# working directory -work="$(pwd)/work.$$" -# path to flactomp3v2.sh script -scriptpath="/usr/bin" -# collection directory -musicpath="/tmp/musikpath" - -# Check exist config and script is exists -# config file can set scriptpath and musicpath +work="$(pwd)/work.$$" # temporary working directory +scriptpath="/usr/bin" # path to flactomp3v2.sh and notify.sh script +musicpath="/tmp/musikpath" # flac collection directory + +# check exist config and scripts +# .albentohandy.conf: set scriptpath and musicpath if [ -f $HOME/.albentohandy.conf ] then source $HOME/.albentohandy.conf @@ -16,11 +13,13 @@ else printf "\nERROR\n%s/.albentohandy.conf does not exists\n" $HOME exit 1 fi +# flactomp3v2.sh: convert flac's to mp3 if [ ! -f $scriptpath/flactomp3v2.sh ] then printf "\nERROR\nflactomp3v2.sh 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 @@ -39,6 +38,9 @@ mkzip=false removework=false cptodest=false +# in cluster you have to same bitrate and +# stereo mode of mp3's on every pc. +# read more about basefile in man parallel if [ -f $HOME/.flactomp3v2.conf ] then BASEFILE="--bf $HOME/.flactomp3v2.conf --cleanup" @@ -93,18 +95,18 @@ currentDate addInfo "albentohandy.sh is started

" addInfo "

Foldende Alben wurden ausgewählt:

" addInfo "

$(cat "$albumlist" | sed 's/$/
/')

" -# make symlinks of original flac'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" for i in $(cat "$albumlist") do cp -rs $musicpath/$i $work/ done -# convert flac to mp3 -# it is the longest phase addInfo "

" currentDate 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 --eta --progress --noswap -S $parallelopts $scriptpath/flactomp3v2.sh {} currentDate @@ -128,6 +130,7 @@ then 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 diff --git a/flactomp3v2.sh b/flactomp3v2.sh index 61ee9ae..20df1ac 100755 --- a/flactomp3v2.sh +++ b/flactomp3v2.sh @@ -5,17 +5,16 @@ BITRATE=192 MODE="j" # check config exists -# config can set BITRATE and MODE +# config .flactomp3v2.conf can set BITRATE and MODE if [ -f $HOME/.flactomp3v2.conf ] then source $HOME/.flactomp3v2.conf fi INPUTFILE=$1 -# give output correct extension -OUTPUTFILE="${INPUTFILE[@]/%flac/mp3}" +OUTPUTFILE="${INPUTFILE[@]/%flac/mp3}" # give output correct extension -# get the tags +# get the tags from flac file ARTIST=$(metaflac "$INPUTFILE" --show-tag=ARTIST | sed s/.*=//g) TITLE=$(metaflac "$INPUTFILE" --show-tag=TITLE | sed s/.*=//g) ALBUM=$(metaflac "$INPUTFILE" --show-tag=ALBUM | sed s/.*=//g) @@ -31,7 +30,7 @@ RAP=$(metaflac "$INPUTFILE" --show-tag=REPLAYGAIN_ALBUM_PEAK | sed s/.*=//g) # stream flac into the lame encoder flac -s -c -d "$INPUTFILE" | lame --silent -b $BITRATE -m $MODE --noreplaygain - "$OUTPUTFILE" -# ID3v2.3 tagging +# ID3v2.3 tagging with cover and without cover if [ -f ${INPUTFILE%/*}/cover.jpg ] then eyeD3 --to-v2.3 \ diff --git a/notify.sh b/notify.sh index 6dd9306..fefbe15 100755 --- a/notify.sh +++ b/notify.sh @@ -3,9 +3,10 @@ # 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" @@ -25,11 +26,13 @@ then fi } +# add current date in message currentDate() { MESSAGE="${MESSAGE}$(date +"%Y-%m-%d %H:%M:%S") " } +# open html, header and body openMail() { MESSAGE="\n \ @@ -39,11 +42,13 @@ openMail() \n" } +# write message addInfo() { MESSAGE="${MESSAGE}$1\n" } +# close body andy html closeMail() { MESSAGE="${MESSAGE}\n \