]> gitweb.hhaalo.de Git - albentohandy.git/commitdiff
add: comments in notify.sh and correction comments
authorBastian Dehn <hhaalo@arcor.de>
Sun, 17 Jul 2016 22:28:30 +0000 (00:28 +0200)
committerBastian Dehn <hhaalo@arcor.de>
Mon, 18 Jul 2016 20:27:31 +0000 (22:27 +0200)
albentohandy.sh
flactomp3v2.sh
notify.sh

index a1bf71c0f1a2215736332758c5ea417b4c1aa5ff..c4b0e6dbae5d25baff9664ca54ff576a10e7a9ff 100755 (executable)
@@ -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</p>"
 addInfo "<p>Foldende Alben wurden ausgew&auml;hlt:</p>"
 addInfo "<p>$(cat "$albumlist" | sed 's/$/<br>/')</p>"
-# 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 "<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
 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
index 61ee9ae4ba5a12daeacd17325af435fbfbef9b8e..20df1ac8a4f3e10f4a0aa7effd1c8ee6c95ca9d9 100755 (executable)
@@ -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 \
index 6dd93063d9406e5f81897137538fe331d5f98166..fefbe15ecacbab3c5001d954572a3ab76aeaadb7 100755 (executable)
--- 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="<html>\n \
@@ -39,11 +42,13 @@ openMail()
 <body>\n"
 }
 
+# write message
 addInfo()
 {
        MESSAGE="${MESSAGE}$1\n"
 }
 
+# close body andy html
 closeMail()
 {
        MESSAGE="${MESSAGE}\n \