]> gitweb.hhaalo.de Git - albentohandy.git/commitdiff
add: comments in albentohandy.sh
authorBastian Dehn <hhaalo@arcor.de>
Mon, 11 Jul 2016 19:43:43 +0000 (21:43 +0200)
committerBastian Dehn <hhaalo@arcor.de>
Mon, 11 Jul 2016 19:43:43 +0000 (21:43 +0200)
albentohandy.sh

index 0b3add1db3170d1a8c26be747a666fbe0b544bf5..69b14f78fbf2a01139b81af8ce752c1e0428dddf 100755 (executable)
@@ -1,11 +1,14 @@
 #!/bin/bash
 
-# work is a directory do symlinked original and convert
+# working directory 
 work="$(pwd)/work.$$"
-# scriptpath is the path to flactomp3v2.sh script
+# path to flactomp3v2.sh script
 scriptpath="/tmp/scripts"
-# musicpath is collection directory
+# collection directory
 musicpath="/tmp/musikpath"
+
+# Check exist config and script is exists
+# config file can set scriptpath and musicpath
 if [ -f $HOME/.albumtohandy.conf ]
 then
        source $HOME/.albumtohandy.conf
@@ -18,6 +21,8 @@ then
        printf "\nERROR\nflactomp3v2.sh do not found in %s\n" $scriptpath
        exit 1
 fi
+
+# set defaults
 albumlist="albumlist"
 parallelopts=":"
 curphase=1
@@ -27,6 +32,7 @@ mkzip=false
 removework=false
 cptodest=false
 
+# read parameters
 while getopts ":ci:m:S::rz:" optname
 do
        case "$optname" in
@@ -56,37 +62,44 @@ do
        esac
 done
 
+# check albumlist is set
 if [ ! -f "$albumlist" ]
 then
        printf "\nalbumlist does not exists\n\n"
        exit
 fi
 
-printf "\nPhase %02d of %02d: create symlinks of flac's to working directory %s\n" $((curphase++)) $phase "$work"
-
+# create working directory
 if [ ! -d $work ]
 then
        mkdir $work
 fi
 
 # 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")
 do
        cp -rs $musicpath/$i $work/
 done
 
+# 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 --eta --progress --noswap -S $parallelopts $scriptpath/flactomp3v2.sh {}
 
+# 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
 
+# create sha256sum in working directory
 if [ $checksum == true ]
 then
        printf "Phase %02d of %02d: create sha256sum\n\n" $((curphase++)) $phase
        find $work -name '*.mp3' | sort | xargs sha256sum | sed "s=$work/==" >> $work/sha256sum
 fi
+
+# make zipfile in the current path
 if [ $mkzip == true ]
 then
        printf "Phase %02d of %02d: create %s\n" $((curphase++)) $phase $zipname
@@ -96,6 +109,8 @@ then
        cd $curpath
        printf "\n"
 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
@@ -105,6 +120,8 @@ then
        fi
        cp -r $work/* $dest
 fi
+
+# delete the working directory
 if ( [ $mkzip == true ] || [ $cptodest == true ] ) && [ $removework == true ]
 then
        printf "cleanup working directory\n\n"