]> gitweb.hhaalo.de Git - albentohandy.git/commitdiff
add checksum option
authorBastian Dehn <hhaalo@arcor.de>
Thu, 23 Jun 2016 17:30:36 +0000 (19:30 +0200)
committerBastian Dehn <hhaalo@arcor.de>
Mon, 27 Jun 2016 18:10:14 +0000 (20:10 +0200)
albentohandy.sh

index c32eba12397cb42e2c7b25d0a05fcdb7632fb0ea..70351d9157fc5f09ffb55f53e8ecd2668f91c8f4 100755 (executable)
@@ -7,6 +7,8 @@ scriptpath="/media/smbdaten1/scripts"
 # musicpath is collection directory
 musicpath="/media/smbdaten1/musik-flac"
 parallelopts=":"
+phase=3
+checksum=false
 
 if [ ! -f albumlist ]
 then
@@ -16,9 +18,13 @@ then
        exit
 fi
 
-while getopts "S:" optname
+while getopts ":cS:" optname
 do
        case "$optname" in
+       "c")
+               checksum=true
+               phase=$(($phase + 1))
+               ;;
        "S")
                parallelopts="$OPTARG"
                ;;
@@ -29,7 +35,7 @@ do
 done
 
 echo
-echo "Phase 01 von 03: flac's in das Arbeitsverzeichnis $work verlinken"
+printf "Phase 01 von %02d: flac's in das Arbeitsverzeichnis %s verlinken\n" "$phase" "$work"
 
 if [ ! -d $work ]
 then
@@ -43,10 +49,16 @@ do
 done
 
 echo
-echo "Phase 02 von 03: flac -> mp3"
+printf "Phase 02 von %02d: flac -> mp3\n" "$phase"
 find $work -name '*.flac' | sort | parallel --eta --progress --noswap -S $parallelopts $scriptpath/flactomp3v2.sh {}
 echo
-echo "Phase 03 von 03: flac's und cover's loeschen"
+printf "Phase 03 von %02d: flac's und cover's loeschen\n" "$phase"
 echo
 find $work -name '*.flac' | sort | xargs rm
 find $work -name 'cover*' | sort | xargs rm
+if [ $checksum == true ]
+then
+       printf "Phase 04 von %02d: erstelle sha256sum\n" "$phase"
+       find $work -name '*.mp3' | sort | xargs sha256sum | sed "s=$work/==" >> $work/sha256sum
+       echo
+fi