Commit 9a103fd6 authored by multrus's avatar multrus
Browse files

make scripts work with whitespace in filenames

parent 0fc4330e
Loading
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -56,18 +56,18 @@ then
    exit
fi

filename=`basename $file`
filename=`basename "$file"`
if [ "$md5" = "md5sum" ]; then
    md5sum=`$md5 -b $file | cut -d" " -f1`
    md5sum=`$md5 -b "$file" | cut -d" " -f1`
elif [ "$md5" = "md5" ]; then
    md5sum=`$md5 -r $file | cut -d" " -f1`
    md5sum=`$md5 -r "$file" | cut -d" " -f1`
else
    echo "No valid executable for calculating md5. Aborting."
    exit
fi

# getting all info from InfoAudio - storing in res
res=`$InfoAudio $file`
res=`$InfoAudio "$file"`

# paring res
sampleFreq=`echo "$res" | grep -m1 "Sampling frequency" | sed -e 's/\([a-zA-Z\. ]*: \)\([0-9]*\)\(.*\)/\2/g'`
@@ -82,7 +82,7 @@ fi

numberChannels=`echo "$res" | grep -m1 "No. channels" | sed -e 's/\([a-zA-Z\. ]*: \)\([0-9]*\)\(.*\)/\2/g'`

dataType=`echo "$res" | grep -m1 "Data type" | sed -e 's/\([a-zA-Z\. ]*: \)\([[a-zA-Z0-9]*\)\(.*\)/\2/g'`
dataType=`echo "$res" | grep -m1 "Data type" | sed -e 's/\([a-zA-Z\. ]*: \)\([[a-zA-Z0-9\-]*\)\(.*\)/\2/g'`

dataByteOrder=`echo "$res" | grep -m1 "Data byte order" | sed -e 's/\([a-zA-Z\. ]*: \)\([[a-zA-Z0-9-]*\)\(.*\)/\2/g'`

+4 −4
Original line number Diff line number Diff line
@@ -45,7 +45,7 @@ InfoAudio=InfoAudio
CopyAudio=CopyAudio

# getting all info from InfoAudio - storing in res
res=`$InfoAudio $file_in`
res=`$InfoAudio "$file_in"`

# paring res
sampleFreq=`echo "$res" | grep -m1 "Sampling frequency" | sed -e 's/\([a-zA-Z\. ]*: \)\([0-9]*\)\(.*\)/\2/g'`
@@ -57,17 +57,17 @@ samplesToPad=0

if [ $remainder -eq 0 ]; then
    # no padding required, just copy files
    cp $file_in $file_out
    cp "$file_in" "$file_out"
else
    samplesToPad=$(expr 960 - $remainder)
    limit=$(expr $samplesToPad - 1)
    
    # copy required number of sampled to pad into temp file, scale with 0 gain --> results in silence
    tmp=`mktemp`
    $CopyAudio -l 0:$limit -g 0 $file_in $tmp
    $CopyAudio -l 0:$limit -g 0 "$file_in" $tmp

    # concatenate original file with silence block
    $CopyAudio --concatenate $file_in $tmp $file_out
    $CopyAudio --concatenate "$file_in" $tmp "$file_out"

    # delete tmp file
    rm -f $tmp